[issue17628] str==str: compare the first and last character before calling memcmp()

Antoine Pitrou report at bugs.python.org
Thu Apr 4 08:21:07 CEST 2013


Antoine Pitrou added the comment:

> I don't understand why the patch makes the comparaison much slower,
> since most time is supposed to be spend in memcmp()?

Because reading the last character evicts useful data from the CPU cache, just before memcmp() reads it again from memory?

In other words, I'm not convinced this is a useful heuristic.

----------

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


More information about the Python-bugs-list mailing list