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 <rep...@bugs.python.org> <http://bugs.python.org/issue16281> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com