aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
diff options
context:
space:
mode:
authorrilysh <nightquick@proton.me>2024-10-02 16:10:06 +0000
committerGitHub <noreply@github.com>2024-10-02 16:10:06 +0000
commit86737c5927c204dc866f1de7c95ab964e98be6af (patch)
treec17ceb5f4f69f9bad75964821b652ab22f22fb6e /contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp
parente8cbb5952d079e8a04b3c3bd58118b2c6b635493 (diff)
Avoid computing strlen() inside loops
Compiling with -O0 (no proper optimizations), strlen() call in loops for comparing the size, isn't being called/initialized before the actual loop gets started, which causes n-numbers of strlen() calls (as long as the string is). Keeping the length before entering in the loop is a good idea. On some places, even with -O2, both GCC and Clang can't recognize this pattern, which seem to happen in an array of char pointer. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: rilysh <nightquick@proton.me> Closes #16584
Diffstat (limited to 'contrib/llvm-project/lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedPythonInterface.cpp')
0 files changed, 0 insertions, 0 deletions