Swiss Maps in Go
summary
Swiss map replaces the old Go map layout in Go 1.24 (with fixes in 1.25) and implements closed hashing with a directory of small bucket slices, storing 7-bit metadata per slot so eight entries are checked at once. The compiler emits SIMD injected via compiler for AMD64 by recognizing a specific function name, yielding up to ~2x faster lookups (big wins on misses) but adds one layer of indirection that hurts cold-cache workloads and has a known empty-struct size bug (issue 71368).
AI-written summary · about
chapters (11)
- 0:00Swiss Maps in Go
- 3:13How Go maps work
- 7:10Evolution to Swiss Maps
- 11:47Performance benchmarks
- 16:46Metadata and hash matching
- 22:41SIMD optimization
- 29:15Memory overhead
- 33:15Regression with empty structs
- 35:43Cold cache issues
- 37:14Go 1.25 improvements
- 41:33Q&A
related talks
28mFaster Go Maps With Swiss Tables
34mHash Maps: more room at the bottom
35mWhat Lies Beneath - A Deep Dive Into Clojure's Data Structures
25m“A Semi Compile/Run-time Map with (Nearly) Zero Overhead Lookup”
39mThe Linux Maple Tree
51mFrom assembler to C++: structure and optimization of CGo ☠️
44mImplementing Software Machines in Go and C
44mImplementing Software Machines in Go and C
