[issue1564] The set implementation should special-case PyUnicode instead of PyString
report at bugs.python.org
Sun Dec 9 21:51:42 CET 2007
Christian Heimes added the comment:
* Moved dictobject.c:unicode_eq() to unicodeobject.c:_PyUnicode_Eq()
* Added another optimization step to _PyUnicode_Eq(). The hash is
required later anyway and comparing two hashes is much faster than
memcmp-ing the unicode objects.
if (unicode_hash(a) != unicode_hash(b))
* Factored out the ((PyUnicodeObject *) v)->hash optimization into a
function object.c:_PyObject_HashFast() which does the trick for
PyUnicode and PyString. The trick was used a couple of times in
dictobject.c and setobject.c. We may even think about moving the trick
to PyObject_Hash() directly.
Added file: http://bugs.python.org/file8904/py3k_optimize_set_unicode2.patch
Tracker <report at bugs.python.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 13600 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-bugs-list/attachments/20071209/b98e1d68/attachment.patch
More information about the Python-bugs-list