Hasty Briefsbeta

Bilingual

Golang Maps: how Swiss Tables replaced the old bucket design

5 days ago
  • Go 1.24 replaces the old bucket-plus-overflow map implementation with a Swiss Table-inspired design, improving cache locality and reducing pointer chasing.
  • Swiss Tables use compact per-slot metadata (control bytes) and group-oriented layout to filter candidates via fingerprint before full key comparison.
  • The new design supports incremental growth with segmented tables and directory routing, avoiding global stop-the-world rehashes.
  • Performance gains are significant in microbenchmarks (30-35% faster for large-map access) but more modest in full applications (around 1.5% geometric mean speedup).
  • Memory efficiency improves due to higher load factors and elimination of overflow chains, with reductions of 0-25% in many workloads.
  • Trade-offs include potential regressions in cold-cache scenarios, sparse large maps, and delete-heavy patterns with tombstone accumulation.
  • Developers should profile their own workloads, as gains depend on map dominance, access patterns, and Go version (ongoing optimizations for 1.27).