[issue17615] String comparison performance regression

STINNER Victor report at bugs.python.org
Mon Apr 8 23:16:45 CEST 2013


STINNER Victor added the comment:

Neil.Hodgson wrote:
"The patch fixes the performance regression on Windows. The 1:1 case is better than either 3.2.4 or 3.3.1 downloads from python.org. Other cases are close to 3.2.4, losing at most around 2%."

Nice, but make sure that your are using the same compiler with the same options (ex: make sure that you are compiling in Release mode).

Neil.Hodgson wrote:
"Perhaps taking a systematic approach to naming would allow Py_UCS1 to be deduced from PyUnicode_1BYTE_KIND and so avoid repeating the information in the case selector and macro invocation."

I don't know how to do that in C. Anyway, I prefer to have a more explicit call to a "simple" macro than magic implicit arguments. Optimizations sometimes make the code harder to read (a good example: the whole PEP 393)...

--

I wrote specialized functions to compare strings for each combination of Unicode kinds, and I added a fast path using wmemcmp() when possible. I don't see other speedup.

On Linux, Comparing astral strings in Python 3.4 is now 3 times faster than Python 3.2 and 3.3. I achieved my goal, I can close the issue :-D

----------

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


More information about the Python-bugs-list mailing list