about summary refs log tree commit diff
path: root/string/strstr.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix strstr bug with huge needles (bug 23637)Wilco Dijkstra2018-09-191-2/+3
| | | | | | | | | | | | | | | The generic strstr in GLIBC 2.28 fails to match huge needles. The optimized AVAILABLE macro reads ahead a large fixed amount to reduce the overhead of repeatedly checking for the end of the string. However if the needle length is larger than this, two_way_long_needle may confuse this as meaning the end of the string and return NULL. This is fixed by adding the needle length to the amount to read ahead. [BZ #23637] * string/test-strstr.c (pr23637): New function. (test_main): Add tests with longer needles. * string/strcasestr.c (AVAILABLE): Fix readahead distance. * string/strstr.c (AVAILABLE): Likewise.
* Simplify and speedup strstr/strcasestr first matchWilco Dijkstra2018-08-031-22/+21
| | | | | | | | | | | | Looking at the benchtests, both strstr and strcasestr spend a lot of time in a slow initialization loop handling one character per iteration. This can be simplified and use the much faster strlen/strnlen/strchr/memcmp. Read ahead a few cachelines to reduce the number of strnlen calls, which improves performance by ~3-4%. This patch improves the time taken for the full strstr benchtest by >40%. * string/strcasestr.c (STRCASESTR): Simplify and speedup first match. * string/strstr.c (AVAILABLE): Likewise.
* Improve strstr performanceWilco Dijkstra2018-07-161-2/+3
| | | | | | | | | | | | | | | | | | Improve strstr performance. Strstr tends to be slow because it uses many calls to memchr and a slow byte loop to scan for the next match. Performance is significantly improved by using strnlen on larger blocks and using strchr to search for the next matching character. strcasestr can also use strnlen to scan ahead, and memmem can use memchr to check for the next match. On the GLIBC bench tests the performance gains on Cortex-A72 are: strstr: +25% strcasestr: +4.3% memmem: +18% On a 256KB dataset strstr performance improves by 67%, strcasestr by 47%. Reviewd-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Fix BZ #14602: strstr and strcasestr return wrong result.Maxim Kuvyrkov2012-10-081-3/+1
|
* Micro-optimize critical path of strstr, strcase and memmem.Maxim Kuvyrkov2012-08-211-0/+1
|
* Detect EOL on-the-fly in strstr, strcasestr and memmem.Maxim Kuvyrkov2012-08-211-2/+4
|
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* SSE4.2 strstr/strcasestr for x86-64.H.J. Lu2009-07-201-2/+7
| | | | | This patch implements SSE4.2 strstr/strcasestr, using Knuth-Morris-Pratt string searching algorithm.
* * string/Makefile (distribute): Add str-two-way.h. cvs/fedora-glibc-20080515T0735Ulrich Drepper2008-05-151-89/+53
| | | | | | | | | | | | | 2008-03-29 Eric Blake <ebb9@byu.net> Rewrite string searches to O(n) rather than O(n^2). * string/str-two-way.h: New file. For linear fixed-allocation string searching. * string/memmem.c: New implementation. * string/strstr.c: New implementation. * string/strcasestr.c: New implementation. * sysdeps/posix/getaddrinfo.c (getaddrinfo): Call _res_hconf_init
* Moved to csu/errno-loc.c.Ulrich Drepper2005-12-141-0/+123
|
* (CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.Ulrich Drepper2004-12-221-123/+0
|
* 2.5-18.1Jakub Jelinek2007-07-121-0/+123