[Python-checkins] cpython: Harmonize the bottom of the outer loop with its entry point

raymond.hettinger python-checkins at python.org
Sun Jun 21 19:47:28 CEST 2015


https://hg.python.org/cpython/rev/50bfb0899095
changeset:   96637:50bfb0899095
user:        Raymond Hettinger <python at rcn.com>
date:        Sun Jun 21 10:47:20 2015 -0700
summary:
  Harmonize the bottom of the outer loop with its entry point
giving a small simplification.  Timings show that hash
pre-check seems only benefit the inner-loop (the linear probes).

files:
  Objects/setobject.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Objects/setobject.c b/Objects/setobject.c
--- a/Objects/setobject.c
+++ b/Objects/setobject.c
@@ -118,7 +118,7 @@
         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 @@
         i = (i * 5 + 1 + perturb) & mask;
 
         entry = &table[i];
-        if (entry->hash == 0 && entry->key == NULL)
+        if (entry->key == NULL)
             goto found_null;
     }
 

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list