From 7e3592dca6e9d1f991ef500e9c66c271474907b7 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Sun, 21 Jun 2015 10:47:20 -0700 Subject: [PATCH] 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). --- Objects/setobject.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Objects/setobject.c b/Objects/setobject.c index d62164773bc..70ec6445710 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; }