]> granicus.if.org Git - python/commitdiff
Harmonize the bottom of the outer loop with its entry point
authorRaymond Hettinger <python@rcn.com>
Sun, 21 Jun 2015 17:47:20 +0000 (10:47 -0700)
committerRaymond Hettinger <python@rcn.com>
Sun, 21 Jun 2015 17:47:20 +0000 (10:47 -0700)
giving a small simplification.  Timings show that hash
pre-check seems only benefit the inner-loop (the linear probes).

Objects/setobject.c

index d62164773bc2acd7b76eb6d7bef4fca01c372677..70ec64457101ea2564c5cfa1270713b1346fe0dd 100644 (file)
@@ -118,7 +118,7 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
         i = (i * 5 + 1 + perturb) & mask;
 
         entry = &table[i];
-        if (entry->hash == 0 && entry->key == NULL)
+        if (entry->key == NULL)
             return entry;
     }
 }
@@ -206,7 +206,7 @@ set_insert_key(PySetObject *so, PyObject *key, Py_hash_t hash)
         i = (i * 5 + 1 + perturb) & mask;
 
         entry = &table[i];
-        if (entry->hash == 0 && entry->key == NULL)
+        if (entry->key == NULL)
             goto found_null;
     }