]> git.ipfire.org Git - thirdparty/glibc.git/commit
string: Speed up strcasecmp test data initialization master
authorMagnus Lindholm <linmag7@gmail.com>
Wed, 5 Aug 2026 21:14:59 +0000 (23:14 +0200)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Fri, 7 Aug 2026 13:47:23 +0000 (10:47 -0300)
commitc1fb5d0e6b8d292ac526974d05c5adb4c3827fb0
treed20fc778196f9392d90fc0f3274c478d64635c07
parent9b323b95567dff46b34157ac4455734633921abb
string: Speed up strcasecmp test data initialization

The strcasecmp and strncasecmp tests repeatedly initialize large
buffers for many combinations of lengths and alignments.  The existing
loops perform a remainder operation and call toupper and tolower for
every element.

Generate at most max_char elements using an additive recurrence and
apply the case conversions while creating this initial pattern.  The
recurrence produces the same sequence as the existing multiplication
and remainder expression.  Expand the completed pattern using bulk
copies.

This preserves the generated test data and locale-dependent case
conversion while substantially reducing the initialization cost on
slower systems.

Signed-off-by: Magnus Lindholm <linmag7@gmail.com>
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
string/test-strcasecmp.c
string/test-strncasecmp.c