Raymond Hettinger added the comment:

Profiling the test suite shows that the short-cut branch NEVER gets taken.
There are no cases where the string lengths, kinds, and 64-bit hashes match, 
but the stings themselves are a mismatch.  The whole theory behind this 
optimization is invalid.  The first characters always match, so you don't need 
to test for them.

Alex, these things are very difficult to measure because the cost of a 100% 
predictable branch is also zero in a tight benchmark.  The negative effects of 
useless tests are subtle and indirect (i.e. blowing other useful things out of 
the branch prediction table).

Victor, thanks for link to 17628.  I will look at that further, but at first 
glance it looks like you're introducing a big wall of code right in the middle 
of a critical loop in code the is supposed to be in-lined.  It too smells of a 
false optimization and places far too much hope that memcmp, case-statements, 
and whatnot will behave awesomely will all compilers.

Unless you object, I'm going to go ahead and remove the bogus test.

----------

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

Reply via email to