-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
Closed
Labels
Description
There are duplicated lookups on unicodekeys_lookup_unicode
.
I am trying to understand this code as manual loop unrolling for performance. but I am not sure that it is intended.
Lines 932 to 961 in be0c106
ix = dictkeys_get_index(dk, i); | |
if (ix >= 0) { | |
PyDictUnicodeEntry *ep = &ep0[ix]; | |
assert(ep->me_key != NULL); | |
assert(PyUnicode_CheckExact(ep->me_key)); | |
if (ep->me_key == key || | |
(unicode_get_hash(ep->me_key) == hash && unicode_eq(ep->me_key, key))) { | |
return ix; | |
} | |
} | |
else if (ix == DKIX_EMPTY) { | |
return DKIX_EMPTY; | |
} | |
perturb >>= PERTURB_SHIFT; | |
i = mask & (i*5 + perturb + 1); | |
ix = dictkeys_get_index(dk, i); | |
if (ix >= 0) { | |
PyDictUnicodeEntry *ep = &ep0[ix]; | |
assert(ep->me_key != NULL); | |
assert(PyUnicode_CheckExact(ep->me_key)); | |
if (ep->me_key == key || | |
(unicode_get_hash(ep->me_key) == hash && unicode_eq(ep->me_key, key))) { | |
return ix; | |
} | |
} | |
else if (ix == DKIX_EMPTY) { | |
return DKIX_EMPTY; | |
} | |
perturb >>= PERTURB_SHIFT; | |
i = mask & (i*5 + perturb + 1); |
First introduced from f8a95df
Please let me know this that is intended.