[issue13134] speed up finding of one-character strings

Antoine Pitrou report at bugs.python.org
Thu Oct 13 16:21:13 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> I think the >1 character sizes are overly complex in this patch, and
> still memchr isn't typically used for them. So I suggest to simplify
> the code and restrict it to 1-byte chars only.

I would rather propose to simplify the needle heuristic and only use it
when the lower byte is non-zero. A properly optimized memchr() (as in
the glibc / gcc) is definitely faster than our naïve loop.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13134>
_______________________________________


More information about the Python-bugs-list mailing list