A hybrid of and-masking and a conditional-set-to-zero produce even faster search loop.

This commit is contained in:
Raymond Hettinger 2015-01-18 21:25:15 -08:00
parent bd9b200b87
commit ed741d4ff0
1 changed files with 2 additions and 1 deletions

View File

@ -671,7 +671,8 @@ set_pop(PySetObject *so)
while ((entry = &so->table[i])->key == NULL || entry->key==dummy) {
i++;
i &= so->mask;
if (i > so->mask)
i = 0;
}
key = entry->key;
entry->key = dummy;