]> granicus.if.org Git - python/commitdiff
Slight rearrangement of code in lookdict() by Vladimir Marangozov, to
authorGuido van Rossum <guido@python.org>
Tue, 6 Oct 1998 16:01:14 +0000 (16:01 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 6 Oct 1998 16:01:14 +0000 (16:01 +0000)
make a common case slightly faster.

Objects/dictobject.c

index 7b6225865b718dc7e33d78cb5146f6398dbd143d..be602b51ffa9756af72d08599cb3b288ab1d9d5c 100644 (file)
@@ -173,14 +173,13 @@ lookdict(mp, key, hash)
           as for ints <sigh>, can have lots of leading zeros. It's not
           really a performance risk, but better safe than sorry. */
        ep = &ep0[i];
-       if (ep->me_key == NULL)
+       if (ep->me_key == NULL || ep->me_key == key)
                return ep;
        if (ep->me_key == dummy)
                freeslot = ep;
        else {
-               if (ep->me_key == key ||
-                (ep->me_hash == hash &&
-                 PyObject_Compare(ep->me_key, key) == 0))
+               if (ep->me_hash == hash &&
+                   PyObject_Compare(ep->me_key, key) == 0)
                {
                        return ep;
                }