diff options
author | Tim Peters <tim.peters@gmail.com> | 2001-05-13 06:43:53 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2001-05-13 06:43:53 (GMT) |
commit | 342c65e19ac0cc47bf2b21026c76e63440b23748 (patch) | |
tree | 55dc4a4a5302dbd46e54f0e17db376d028653aa3 /Doc/libstd.tex | |
parent | 2f228e75e4d5ac8c3eb4a6334dbc43243bff1095 (diff) | |
download | cpython-342c65e19ac0cc47bf2b21026c76e63440b23748.zip cpython-342c65e19ac0cc47bf2b21026c76e63440b23748.tar.gz cpython-342c65e19ac0cc47bf2b21026c76e63440b23748.tar.bz2 |
Aggressive reordering of dict comparisons. In case of collision, it stands
to reason that me_key is much more likely to match the key we're looking
for than to match dummy, and if the key is absent me_key is much more
likely to be NULL than dummy: most dicts don't even have a dummy entry.
Running instrumented dict code over the test suite and some apps confirmed
that matching dummy was 200-300x less frequent than matching key in
practice. So this reorders the tests to try the common case first.
It can lose if a large dict with many collisions is mostly deleted, not
resized, and then frequently searched, but that's hardly a case we
should be favoring.
Diffstat (limited to 'Doc/libstd.tex')
0 files changed, 0 insertions, 0 deletions