• Tim Peters's avatar
    Aggressive reordering of dict comparisons. In case of collision, it stands · 342c65e1
    Tim Peters yazdı
    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.
    342c65e1
dictobject.c 39.6 KB