[issue16281] TODO in tailmatch(): it does not support backward in all cases
Serhiy Storchaka
report at bugs.python.org
Thu Nov 1 20:08:05 CET 2012
Serhiy Storchaka added the comment:
The result does not depend on the direction of comparison. This only affects speed. But who can to say in which direction comparison will be faster?
Here I see a one obvious opportunity for optimization:
if (kind_self < kind_sub)
return 0;
After that and after processing the case (kind_self == kind_sub) only 3 special cases left: UCS1 in UCS2, UCS1 in UCS4, and UCS2 in UCS4. Get rid of slow PyUnicode_READ() for this cases will speed up the code. Also note that comparing first and last characters before memcmp can be a slowdown (because PyUnicode_READ() is slow). Try to compare first and last bytes.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16281>
_______________________________________
More information about the Python-bugs-list
mailing list