Modern Dictionaries by Raymond Hettinger
SF PythonYouTube ↗
Further reading 2
When is a typo a valid program? →Features can interact so that an unintended expression still parses. The language accepts it, leaving the programmer to discover the changed meaning.What does a repeated microbenchmark leave out? →Compare the costs visible in an isolated hash-table operation with the effect of workload and cache behavior. Microbenchmarks help answer a narrower question than end-to-end measurements.
Caption notes
Python dictionaries use sparse indices and dense entries to improve memory use and iteration. Deletion, probing and ordering semantics shape the tradeoffs.
Original passages · 6
smush all of these together and put the holes in a tiny little tablestore is key one time the hash one time and only save the valuesfeatures that individually seem to make sense but brought together might be terriblewhen you go to time it you're timing the feature of interest which puts it in cash anywaywe fetch an entire cache line at a timethere's no space in between them