[Greg Ewing] > This could be incorporated into PyDict. Instead of storing keys and > values in the same array, keep them in separate arrays and only > allocate the values array the first time someone stores a value other > than 1. [Guido] > Not a bad idea! In theory, but if Vladimir were here he'd bust a gut over the possibly bad cache effects on "real dicts" (by keeping everything together, simply accessing the cached hash code brings both the key and value pointers into L1 cache too). We would need to quantify the effect of breaking that connection. > (But shouldn't the default value be something else, > like none?) Bleech. I hate the idiom of using a false value to mean "present". d = {} for x in seq: d[x] = 1 runs faster too (None needs a LOAD_GLOBAL now).
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4