[issue16286] Use hash if available to optimize a==b and a!=b for bytes and str

STINNER Victor report at bugs.python.org
Thu Nov 7 11:17:18 CET 2013


STINNER Victor added the comment:

I added recently a new _PyUnicode_CompareWithId() function: changeset 77bebcf5c4cf (issue #19512).

This function can be used instead of PyUnicode_CompareWithASCIIString() when the right parameter is a common string. It is interesting when the right string is probably present in a dictionary. For example, "path" is always present as "sys.path". So interning the string doesn't eat more memory.

_PyUnicode_CompareWithId() would be more efficient with compare_hash-3.patch. The function is not used yet in critical path. It is now used in type_new() for example.

----------

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


More information about the Python-bugs-list mailing list