[issue18719] Remove false optimizaton for equality comparison of hashed strings

Raymond Hettinger report at bugs.python.org
Mon Aug 12 22:38:03 CEST 2013


New submission from Raymond Hettinger:

This code is only run when the kinds, lengths, and hashes match.  So, the probability of the strings being equal is VERY high.  Accordingly, there is no benefit to an earlier out test to see if the first characters differ.

There is a modest benefit to comparing one-character strings, but that comes at the expense of of testing all other string lengths.

This code is on the critical path for dicts and sets, so we don't want to slow it down with false optimizations or optimizations of special cases that come at the expense of the common, general case.

----------
keywords: +patch
Added file: http://bugs.python.org/file31258/eq_optimization.diff

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


More information about the Python-bugs-list mailing list