Skip to content
Commit 80b2bfb5 authored by Wilco Dijkstra's avatar Wilco Dijkstra
Browse files

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: default avatarAdhemerval Zanella <adhemerval.zanella@linaro.org>

	* benchtests/bench-strstr.c (test_hard_needle): New function.
parent e6e24243
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment