about summary refs log tree commit diff
path: root/string/strstr.c
diff options
context:
space:
mode:
authorWilco Dijkstra <wdijkstr@arm.com>2019-06-11 15:52:21 +0100
committerWilco Dijkstra <wdijkstr@arm.com>2019-06-11 15:52:21 +0100
commit80b2bfb5350442ef1a781b0ee9dd44d61bd88f8a (patch)
tree26b7514b56164261c5cf4870602ae06ab79cea42 /string/strstr.c
parente6e24243905957c36596f50a22af0acfd83793e2 (diff)
downloadglibc-80b2bfb5350442ef1a781b0ee9dd44d61bd88f8a.tar.gz
glibc-80b2bfb5350442ef1a781b0ee9dd44d61bd88f8a.tar.xz
glibc-80b2bfb5350442ef1a781b0ee9dd44d61bd88f8a.zip
Benchmark strstr hard needles
Benchmark needles which exhibit worst-case performance.  This shows that
basic_strstr is quadratic and thus unsuitable for large needles.
On the other hand the Two-way and new strstr implementations are linear with
increasing needle sizes.  The slowest cases of the two implementations are
within a factor of 2 on several different microarchitectures.  Two-way is
slowest on inputs which cause a branch mispredict on almost every character.
The new strstr is slowest on inputs which almost match and result in many
calls to memcmp.  Thanks to Szabolcs for providing various hard needles.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

	* benchtests/bench-strstr.c (test_hard_needle): New function.
Diffstat (limited to 'string/strstr.c')
0 files changed, 0 insertions, 0 deletions