[issue17615] String comparison performance regression

Martin v. Löwis report at bugs.python.org
Wed Apr 10 00:20:46 CEST 2013


Martin v. Löwis added the comment:

I'd like to propose a code size reduction. If kind1 < kind2, swap(kind1, kind2) and swap(data1, data2). Set a variable swapped to 1 (not swapped) or -1 (swapped); then return either swapped or -swapped when a difference is found.

With that, the actual comparison could be sure that kind2 <= kind1, so if kind1 is UCS1, the inner switch can go away. If kind1 is UCS2, kind1 could only be UCS1 or UCS2.

----------
nosy: +loewis

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


More information about the Python-bugs-list mailing list