Raymond Hettinger added the comment:

The dont-compare-first-last patch looks about right.

The "if (len == 0) return 1;" shortcut perhaps should be taken out.  It makes 
the common case pay (if only slightly) for the rare case (which of course, 
never gets predicted).  This whole code block gets inlined in the very tight 
inner loops of the set/dict lookkey functions -- it should be as thin as 
possible.

One other thing to take a look at is the "PyUnicode_GET_LENGTH(a) * 
PyUnicode_KIND(a)" expression.  The disassembly shows an imulq instruction 
rather than the usual scaled LEA computation.  I don't know if this can be 
sped-up by a predictable branch for the common case.

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17628>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to