summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-10-06 16:01:14 (GMT)
committerGuido van Rossum <guido@python.org>1998-10-06 16:01:14 (GMT)
commitc1c7b1a699bfed4120cc9d52c60f16a67da5fa13 (patch)
tree92d373929d2b9abc8ab8114825a1dfc65723a4b9 /Objects
parent73290dff302184e4d7e4b1fd2cc34faf3283a096 (diff)
downloadcpython-c1c7b1a699bfed4120cc9d52c60f16a67da5fa13.zip
cpython-c1c7b1a699bfed4120cc9d52c60f16a67da5fa13.tar.gz
cpython-c1c7b1a699bfed4120cc9d52c60f16a67da5fa13.tar.bz2
Slight rearrangement of code in lookdict() by Vladimir Marangozov, to
make a common case slightly faster.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/dictobject.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 7b62258..be602b5 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -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;
}