diff options
author | Raymond Hettinger <python@rcn.com> | 2015-02-09 12:48:29 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2015-02-09 12:48:29 (GMT) |
commit | 438f9134cfb7a3b68cff9de9f730f42f68c2cc94 (patch) | |
tree | 58380de57af001f495ccd3051dbe526b549867b6 /Objects | |
parent | 54576da2b4893d1ca6d3d0c6fe6e87be9480f933 (diff) | |
download | cpython-438f9134cfb7a3b68cff9de9f730f42f68c2cc94.zip cpython-438f9134cfb7a3b68cff9de9f730f42f68c2cc94.tar.gz cpython-438f9134cfb7a3b68cff9de9f730f42f68c2cc94.tar.bz2 |
Mirco-optimizations to reduce register spills and reloads observed on CLANG and GCC.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/setobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/setobject.c b/Objects/setobject.c index 23ab95c..8197cd9 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -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; } } |