February 23, 2026
Hash Wars: lock-free vs lock-fans
Benchmarks for concurrent hash map implementations in Go
Go devs ignite a map speed showdown — fair play or favorite picks
TLDR: A Go developer benchmarked popular concurrent maps, including the standard library’s improved sync.Map, across sizes and workloads. The community praised the neutrality but split over author bias, real‑world relevance, and whether lock‑free or sharded designs win, turning the results into a lively speed‑map showdown.
A Go developer just dropped a mega-benchmark pitting five ways to share a dictionary across many threads — and yes, the author wrote one of the contenders. Cue instant drama: one camp cheers the transparency, the other yells “fox guarding the henhouse,” while everyone argues over what actually matters. The standout vibe? Respect for the write-up’s trade-offs and clear tests, with top commenters applauding that it didn’t just crown a winner. Still, people went spicy. Some insist the standard library’s sync.Map is finally “grown-up” thanks to Go 1.24’s new design, others swear the sharded old favorite feels safer, and the lock‑free crowd flexes like they just found free speed. The charts show ops-per-second across different map sizes (from “fits in the tiny chip cache” to “spills into RAM”) and worker counts; one lock‑free library even had to tap out at big sizes, fueling the “benchmarks aren’t real life” chorus. Jokes flew: “GOMAXDRAMA,” “HashTrie sounds like a dinosaur,” and “zero allocations? My memory leak says hi.” A practical thread grumbled that most apps aren’t 99% reads, while a performance‑purist shot back that read-heavy paths are where speed wins. Through it all, the mood is: thank you for the data, now let’s argue about it.
Key Points
- •Benchmarks compare Go concurrent hash map implementations: sync.Map, xsync.Map, cornelk/hashmap, alphadose/haxmap, and orcaman/concurrent-map.
- •Workloads span 100%, 99%, 90%, and 75% read mixes and a range-under-contention scenario.
- •Key types include strings with long prefixes and ints; map sizes target CPU cache tiers up to RAM.
- •Tests were run on AMD Ryzen 9 7900 with Linux, Go 1.26.0, and GOMAXPROCS set to 1, 4, 8, and 12.
- •All libraries report 0 allocs/op in read/write benchmarks; cornelk/hashmap was only tested at sizes 100 and 1,000 due to performance degradation at larger sizes.