From: Raymond Hettinger Date: Wed, 14 Aug 2013 01:34:49 +0000 (-0700) Subject: Issue 18719: Remove a false optimization X-Git-Tag: v2.7.6rc1~241 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e413bd28849605d935e6e146be747f71f8fd5a1;p=thirdparty%2FPython%2Fcpython.git Issue 18719: Remove a false optimization 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). --- diff --git a/Objects/stringobject.c b/Objects/stringobject.c index b80ef87b0d8d..e1ea3cd80f7c 100644 --- a/Objects/stringobject.c +++ b/Objects/stringobject.c @@ -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; }