[issue28943] Use PyUnicode_MAX_CHAR_VALUE instead of PyUnicode_KIND in some API's short path
Serhiy Storchaka
report at bugs.python.org
Mon Dec 12 06:37:38 EST 2016
Serhiy Storchaka added the comment:
PyUnicode_KIND() just extracts three bits from the state word. PyUnicode_MAX_CHAR_VALUE() extracts bits multiple times and does few conditional branching. I think it is much slower that PyUnicode_KIND(). In common case you search ASCII needle or the needle of the same kind as a string, therefore checking for fast path just adds the overhead. It is appropriate while the overhead is tiny.
Optimize common cases, not rare and obscure cases.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28943>
_______________________________________
More information about the Python-bugs-list
mailing list