[issue41972] bytes.find consistently hangs in a particular scenario

Dennis Sweeney report at bugs.python.org
Mon Oct 12 03:00:37 EDT 2020


Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:

Here is a C implementation of the two-way algorithm that should work as a drop-in replacement for Objects/stringlib/fastsearch.h.

Benchmarking so far, it looks like it is a bit slower in a lot of cases. But it's also a bit faster in a some other cases and oodles faster in the really bad cases.

I wonder if there's a good heuristic cutoff (for the needle size?) where the two-way usually becomes better.

----------
Added file: https://bugs.python.org/file49508/fastsearch.h

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41972>
_______________________________________


More information about the Python-bugs-list mailing list