diff options
author | rilysh <[email protected]> | 2024-10-02 21:40:06 +0530 |
---|---|---|
committer | GitHub <[email protected]> | 2024-10-02 09:10:06 -0700 |
commit | 86737c5927c204dc866f1de7c95ab964e98be6af (patch) | |
tree | c17ceb5f4f69f9bad75964821b652ab22f22fb6e /man | |
parent | e8cbb5952d079e8a04b3c3bd58118b2c6b635493 (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 <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: rilysh <[email protected]>
Closes #16584
Diffstat (limited to 'man')
0 files changed, 0 insertions, 0 deletions