Fastest String Search Algorithm.

Amit Choudhary amitchoudhary0523@gmail.com
Wed Jun 9 14:08:01 GMT 2021


On Wed, Jun 9, 2021, 7:10 PM Adhemerval

>
> You send only one test with a specific usage, this is hardly a way to
> fully verify the performance implication of a new implementation.  That's
> why I think we need to integrate newer tests on the bench-strstr to have
> meaningful and *replicated* data.
>

I don't think that you have seen what is the haystack and needles for
strstr test.

Basically, there is one haystack and needles with different sizes.

I have done the same tests on my side. I have one text of 60 KB and my
needle sizes are 3.2 KB, 4.4 KB, 5.9 KB, 7 KB, and 28 KB.

So, my tests are similar to those of strstr() benchmark.

Also, I have already mentioned that my algorithm is faster than strstr()
when needle size is greater than or equal to 4.4 KB.

I haven't yet tested with 4 KB needle.

But, as Wilco pointed out, no one will use 4 KB needle so then it is
obvious that my algorithm will not be included in glibc.

So, why should I spend more time on this?

There are many other languages than C (like Java, PHP, etc.) that have
their own implementation of string search.

So, I will spend my time there to evaluate string search algorithms of
these languages.

Regards,
Amit


More information about the Libc-alpha mailing list