[issue17615] String comparison performance regression

Serhiy Storchaka report at bugs.python.org
Mon Apr 8 12:24:48 CEST 2013


Serhiy Storchaka added the comment:

You can use a single switch instead nested switches:

switch ((kind1 << 3) + kind2) {
case (PyUnicode_1BYTE_KIND << 3) + PyUnicode_1BYTE_KIND: {
    int cmp = memcmp(data1, data2, len);
    ...
}
case (PyUnicode_1BYTE_KIND << 3) + PyUnicode_2BYTE_KIND:
    COMPARE(Py_UCS1, Py_UCS2);
    break;
...
}

I don't know if there is any effect.

----------
components: +Interpreter Core
stage: needs patch -> patch review

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


More information about the Python-bugs-list mailing list