mirror_zfs/module/zcommon
rilysh 86737c5927
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
2024-10-02 09:10:06 -07:00
..
cityhash.c zcommon: add specialized versions of cityhash4 2024-09-19 15:18:59 -07:00
simd_stat.c Add missing guard defines for simd_stat 2024-09-24 09:07:26 -07:00
zfeature_common.c Support for longnames for files/directories (Linux part) 2024-10-01 13:40:27 -07:00
zfs_comutil.c nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
zfs_deleg.c nvpair: Constify string functions 2023-03-14 15:25:50 -07:00
zfs_fletcher_aarch64_neon.c Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_fletcher_avx512.c Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_fletcher_intel.c Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_fletcher_sse.c Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_fletcher_superscalar4.c Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_fletcher_superscalar.c Drop lying to the compiler in the fletcher4 code 2023-03-24 10:29:19 -07:00
zfs_fletcher.c Replace P2ALIGN with P2ALIGN_TYPED and delete P2ALIGN. 2024-05-10 08:47:21 -07:00
zfs_namecheck.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00
zfs_prop.c Avoid computing strlen() inside loops 2024-10-02 09:10:06 -07:00
zfs_valstr.c Adding Direct IO Support 2024-09-14 13:47:59 -07:00
zpool_prop.c Avoid computing strlen() inside loops 2024-10-02 09:10:06 -07:00
zprop_common.c Replace dead opensolaris.org license link 2022-07-11 14:16:13 -07:00