]> git.ipfire.org Git - thirdparty/glibc.git/commit - ChangeLog
Benchmark strstr hard needles
authorWilco Dijkstra <wdijkstr@arm.com>
Tue, 11 Jun 2019 14:52:21 +0000 (15:52 +0100)
committerWilco Dijkstra <wdijkstr@arm.com>
Tue, 11 Jun 2019 14:52:21 +0000 (15:52 +0100)
commit80b2bfb5350442ef1a781b0ee9dd44d61bd88f8a
tree26b7514b56164261c5cf4870602ae06ab79cea42
parente6e24243905957c36596f50a22af0acfd83793e2
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.
ChangeLog
benchtests/bench-strstr.c