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 12
12
13
13
To improve cache locality, each probe inspects a series of consecutive
14
14
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
16
16
reduces the cost of hash collisions because consecutive memory accesses
17
17
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.
20
21
21
22
All arithmetic on hash should ignore overflow.
22
23
23
24
Unlike the dictionary implementation, the lookkey function can return
24
25
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.
25
32
*/
26
33
27
34
#include "Python.h"
You can’t perform that action at this time.
0 commit comments