File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 1212
1313 To improve cache locality, each probe inspects a series of consecutive
1414 nearby entries before moving on to probes elsewhere in memory. This leaves
15- us with a hybrid of linear probing and open addressing . The linear probing
15+ us with a hybrid of linear probing and randomized probing . The linear probing
1616 reduces the cost of hash collisions because consecutive memory accesses
1717 tend to be much cheaper than scattered probes. After LINEAR_PROBES steps,
18- we then use open addressing with the upper bits from the hash value. This
19- helps break-up long chains of collisions.
18+ we then use more of the upper bits from the hash value and apply a simple
19+ linear congruential random number genearator. This helps break-up long
20+ chains of collisions.
2021
2122 All arithmetic on hash should ignore overflow.
2223
2324 Unlike the dictionary implementation, the lookkey function can return
2425 NULL if the rich comparison returns an error.
26+
27+ Use cases for sets differ considerably from dictionaries where looked-up
28+ keys are more likely to be present. In contrast, sets are primarily
29+ about membership testing where the presence of an element is not known in
30+ advance. Accordingly, the set implementation needs to optimize for both
31+ the found and not-found case.
2532*/
2633
2734#include "Python.h"
You can’t perform that action at this time.
0 commit comments