From: Guido van Rossum Date: Tue, 6 Oct 1998 16:01:14 +0000 (+0000) Subject: Slight rearrangement of code in lookdict() by Vladimir Marangozov, to X-Git-Tag: v1.5.2a2~147 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c1c7b1a699bfed4120cc9d52c60f16a67da5fa13;p=python Slight rearrangement of code in lookdict() by Vladimir Marangozov, to make a common case slightly faster. --- diff --git a/Objects/dictobject.c b/Objects/dictobject.c index 7b6225865b..be602b51ff 100644 --- a/Objects/dictobject.c +++ b/Objects/dictobject.c @@ -173,14 +173,13 @@ lookdict(mp, key, hash) as for ints , 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; }