Commit bc9abe21 authored by Guido van Rossum's avatar Guido van Rossum

Slight rearrangement of code in lookdict() by Vladimir Marangozov, to

make a common case slightly faster.
parent 7bfcdaf0
...@@ -173,14 +173,13 @@ lookdict(mp, key, hash) ...@@ -173,14 +173,13 @@ lookdict(mp, key, hash)
as for ints <sigh>, can have lots of leading zeros. It's not as for ints <sigh>, can have lots of leading zeros. It's not
really a performance risk, but better safe than sorry. */ really a performance risk, but better safe than sorry. */
ep = &ep0[i]; ep = &ep0[i];
if (ep->me_key == NULL) if (ep->me_key == NULL || ep->me_key == key)
return ep; return ep;
if (ep->me_key == dummy) if (ep->me_key == dummy)
freeslot = ep; freeslot = ep;
else { else {
if (ep->me_key == key || if (ep->me_hash == hash &&
(ep->me_hash == hash && PyObject_Compare(ep->me_key, key) == 0)
PyObject_Compare(ep->me_key, key) == 0))
{ {
return ep; return ep;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment