]> granicus.if.org Git - python/commitdiff
Issue 18719: Remove a false optimization
authorRaymond Hettinger <python@rcn.com>
Wed, 14 Aug 2013 01:34:49 +0000 (18:34 -0700)
committerRaymond Hettinger <python@rcn.com>
Wed, 14 Aug 2013 01:34:49 +0000 (18:34 -0700)
Remove an unused early-out test from the critical path for
dict and set lookups.

When the strings already have matching lengths and hashes,
there is no additional information gained by checking the first
characters (the probability of a mismatch is already known to
be less than 1 in 2**64).

Objects/stringobject.c

index b80ef87b0d8d94f8612da4a455030e7db7ebe204..e1ea3cd80f7c87ebd727554ae9dea218edf9648a 100644 (file)
@@ -1255,7 +1255,6 @@ _PyString_Eq(PyObject *o1, PyObject *o2)
     PyStringObject *a = (PyStringObject*) o1;
     PyStringObject *b = (PyStringObject*) o2;
     return Py_SIZE(a) == Py_SIZE(b)
-      && *a->ob_sval == *b->ob_sval
       && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0;
 }