]> granicus.if.org Git - python/commitdiff
Mirco-optimizations to reduce register spills and reloads observed on CLANG and GCC.
authorRaymond Hettinger <python@rcn.com>
Mon, 9 Feb 2015 12:48:29 +0000 (06:48 -0600)
committerRaymond Hettinger <python@rcn.com>
Mon, 9 Feb 2015 12:48:29 +0000 (06:48 -0600)
Objects/setobject.c

index 23ab95c715d620596d4fabc0f1cf893f80a6c366..8197cd914aded821e73292f74c9e79258df701f4 100644 (file)
@@ -84,8 +84,9 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
                 return set_lookkey(so, key, hash);
             if (cmp > 0)                                          /* likely */
                 return entry;
+            mask = so->mask;                 /* help avoid a register spill */
         }
-        if (entry->key == dummy && freeslot == NULL)
+        if (entry->hash == -1 && freeslot == NULL)
             freeslot = entry;
 
         if (i + LINEAR_PROBES <= mask) {
@@ -111,8 +112,9 @@ set_lookkey(PySetObject *so, PyObject *key, Py_hash_t hash)
                         return set_lookkey(so, key, hash);
                     if (cmp > 0)
                         return entry;
+                    mask = so->mask;
                 }
-                if (entry->key == dummy && freeslot == NULL)
+                if (entry->hash == -1 && freeslot == NULL)
                     freeslot = entry;
             }
         }