[issue17628] str==str: compare the first and last character before calling memcmp()
Eric Snow
report at bugs.python.org
Thu Apr 4 19:00:13 CEST 2013
Eric Snow added the comment:
> Marc-Andre Lemburg added the comment:
> Same here. The heuristic may work for short strings that easily fit
> into the CPU cache, but as soon as you use it on longer strings,
> this will result in much slower comparisons.
When testing both, would it help to test the end of the string before the beginning? I'd expect that be more likely to leave the beginning in the cache for any subsequent memcmp() call.
----------
nosy: +eric.snow
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17628>
_______________________________________
More information about the Python-bugs-list
mailing list