Raymond Hettinger added the comment:

I had intentionally moved the entry->key == key test to be after the hash test. 
 Unlike dicts where exact key matches are norm, sets are used for deduping 
(cased where keys are equal but not dups).

By moving the test inside the entry->key == hash test, we reduce the number of 
comparisons per loop for collisions and increase the predictability of the 
entry->key == key branch (once the hash matches, the chance of an equality 
match is very high.

The one part I'm looking at changing is moving the dummy test after the 
identity key test.  However, the dummy test inside the hash test is perfectly 
predictable (it basicly never matches) and may be cost free.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23282>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to