From: Raymond Hettinger Date: Sun, 21 Jun 2015 17:47:20 +0000 (-0700) Subject: Harmonize the bottom of the outer loop with its entry point X-Git-Tag: v3.6.0a1~2058 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7e3592dca6e9d1f991ef500e9c66c271474907b7;p=thirdparty%2FPython%2Fcpython.git 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). --- diff --git a/Objects/setobject.c b/Objects/setobject.c index d62164773bc2..70ec64457101 100644 --- a/Objects/setobject.c +++ b/Objects/setobject.c @@ -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; }