[issue17615] String comparison performance regression

Antoine Pitrou report at bugs.python.org
Mon Apr 8 14:55:18 CEST 2013


Antoine Pitrou 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);
>     ...
> }

Please let's not add this kind of optifuscation unless it has a large positive effect.

----------

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


More information about the Python-bugs-list mailing list