From 0e413bd28849605d935e6e146be747f71f8fd5a1 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 13 Aug 2013 18:34:49 -0700 Subject: 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). --- Objects/stringobject.c | 1 - 1 file changed, 1 deletion(-) diff --git a/Objects/stringobject.c b/Objects/stringobject.c index b80ef87..e1ea3cd 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; } -- cgit v0.12