710e45c4b8
The previous code neglected to use primitives which can find the end of the string without having to branch on every character. While here augment the somewhat misleading commentary -- strlen as implemented here leaves performance on the table, especially so for userspace. Every arch should get a dedicated variant instead. In the meantime this commit lessens the problem. Tested with glibc test suite. Naive test just calling strlen in a loop on Haswell (ops/s): $(perl -e "print 'A' x 3"): before: 211198039 after: 338626619 $(perl -e "print 'A' x 100"): before: 83151997 after: 98285919 |
||
---|---|---|
.. | ||
bcmp.3 | ||
bcmp.c | ||
bcopy.3 | ||
bcopy.c | ||
bstring.3 | ||
bzero.3 | ||
bzero.c | ||
ffs.3 | ||
ffs.c | ||
ffsl.c | ||
ffsll.c | ||
fls.c | ||
flsl.c | ||
flsll.c | ||
index.3 | ||
Makefile.inc | ||
memccpy.3 | ||
memccpy.c | ||
memchr.3 | ||
memchr.c | ||
memcmp.3 | ||
memcmp.c | ||
memcpy.3 | ||
memcpy.c | ||
memmem.3 | ||
memmem.c | ||
memmove.3 | ||
memmove.c | ||
memrchr.c | ||
memset_s.c | ||
memset.3 | ||
memset.c | ||
stpcpy.c | ||
stpncpy.c | ||
strcasecmp.3 | ||
strcasecmp.c | ||
strcasestr.c | ||
strcat.3 | ||
strcat.c | ||
strchr.3 | ||
strchr.c | ||
strchrnul.c | ||
strcmp.3 | ||
strcmp.c | ||
strcoll.3 | ||
strcoll.c | ||
strcpy.3 | ||
strcpy.c | ||
strcspn.c | ||
strdup.3 | ||
strdup.c | ||
strerror.3 | ||
strerror.c | ||
string.3 | ||
strlcat.c | ||
strlcpy.3 | ||
strlcpy.c | ||
strlen.3 | ||
strlen.c | ||
strmode.3 | ||
strmode.c | ||
strncat.c | ||
strncmp.c | ||
strncpy.c | ||
strndup.c | ||
strnlen.c | ||
strnstr.c | ||
strpbrk.3 | ||
strpbrk.c | ||
strrchr.c | ||
strsep.3 | ||
strsep.c | ||
strsignal.c | ||
strspn.3 | ||
strspn.c | ||
strstr.3 | ||
strstr.c | ||
strtok.3 | ||
strtok.c | ||
strxfrm.3 | ||
strxfrm.c | ||
swab.3 | ||
swab.c | ||
Symbol.map | ||
timingsafe_bcmp.3 | ||
timingsafe_bcmp.c | ||
timingsafe_memcmp.c | ||
wcpcpy.c | ||
wcpncpy.c | ||
wcscasecmp.c | ||
wcscat.c | ||
wcschr.c | ||
wcscmp.c | ||
wcscoll.3 | ||
wcscoll.c | ||
wcscpy.c | ||
wcscspn.c | ||
wcsdup.c | ||
wcslcat.c | ||
wcslcpy.c | ||
wcslen.c | ||
wcsncasecmp.c | ||
wcsncat.c | ||
wcsncmp.c | ||
wcsncpy.c | ||
wcsnlen.c | ||
wcspbrk.c | ||
wcsrchr.c | ||
wcsspn.c | ||
wcsstr.c | ||
wcstok.3 | ||
wcstok.c | ||
wcswidth.3 | ||
wcswidth.c | ||
wcsxfrm.3 | ||
wcsxfrm.c | ||
wmemchr.3 | ||
wmemchr.c | ||
wmemcmp.c | ||
wmemcpy.c | ||
wmemmove.c | ||
wmemset.c |