- Updated: February 23, 2026
- 6 min read
Go Concurrent Map Benchmark Reveals Performance Insights
The go-concurrent-map-bench repository provides a comprehensive benchmark suite for evaluating concurrent hash‑map implementations in Go, delivering concrete performance data that helps developers choose the right data structure for high‑throughput, low‑latency applications.
Overview of the go-concurrent-map-bench Repository
The go-concurrent-map-bench repository is an open‑source Go library released under the Apache‑2.0 license. It aggregates a set of rigorously designed benchmarks that compare five popular concurrent map implementations:
- sync.Map – the standard library’s map introduced in Go 1.24 with a hash‑trie backend.
- xsync.Map – a cache‑line‑aware hash table with lock‑free reads.
- cornelk/hashmap – a lock‑free design that couples a hash index with sorted linked lists.
- alphadose/haxmap – a lock‑free linked‑list algorithm built on top of a hash index.
- orcaman/concurrent-map – a sharded map using 32 fixed shards protected by
sync.RWMutex.
Each implementation is evaluated across a matrix of workloads, key types, and map sizes, providing a holistic view of Go concurrency performance characteristics.
Benchmark Methodology and Workload Configurations
The benchmark suite follows a MECE (Mutually Exclusive, Collectively Exhaustive) approach, ensuring that every test isolates a single variable while covering the full spectrum of realistic scenarios.
Workload Mixes
Four read‑heavy mixes are defined, each expressed as a permille‑based random operation selector:
| Mix | Read % | Write % (store) | Delete % |
|---|---|---|---|
| 100% reads | 100 | 0 | 0 |
| 99% reads | 99 | 0.5 | 0.5 |
| 90% reads | 90 | 5 | 5 |
| 75% reads | 75 | 12.5 | 12.5 |
Key Types and Map Sizes
Two key families are exercised:
- String keys – long prefixes to stress hash functions.
- Integer keys – sequential numbers for cache‑friendly access patterns.
Four map size buckets simulate different memory hierarchies:
- ≈100 entries (≈15 KB) – fits in L1 cache.
- ≈1 000 entries (≈150 KB) – fits in L2 cache.
- ≈100 000 entries (≈15 MB) – fits in L3 cache.
- ≈1 000 000 entries (≈150 MB) – spills to RAM.
Warm‑up Variants
Two initialization strategies are provided:
- WarmUp – the map is pre‑populated before the benchmark starts, ensuring that read‑only workloads measure steady‑state performance.
- NoWarmUp – the map starts empty, allowing mixed read/write workloads to include allocation overhead.
Execution Environment
All benchmarks were executed on a consistent hardware platform:
- CPU: AMD Ryzen 9 7900 (12‑core, 24 threads)
- OS: Linux (amd64)
- Go version: 1.26.0
- GOMAXPROCS values: 1, 4, 8, 12
Each test runs for 3 seconds, repeated three times, and the median ops/s is reported.
Key Performance Results and Comparisons
The benchmark results reveal clear winners and losers across different dimensions. Below is a distilled summary that highlights the most actionable insights for Go developers.
Read‑Only Workloads (100 % reads)
When the workload is pure reads, sync.Map and xsync.Map dominate:
- sync.Map – benefits from lock‑free reads via atomic pointer traversal, delivering the highest ops/s on large map sizes.
- xsync.Map – matches or exceeds sync.Map on smaller maps (size = 100) thanks to its cache‑line‑aware bucket design.
Both cornelk/hashmap and alphadose/haxmap lag behind in pure‑read scenarios because their lock‑free designs incur extra CAS overhead for each lookup.
Mixed Read/Write Workloads (99 %–75 % reads)
As write intensity rises, xsync.Map consistently outperforms the competition:
- In the 90 % read mix, xsync.Map delivers up to 30 % higher throughput than sync.Map.
- At 75 % reads, xsync.Map remains the top performer, while orcaman/concurrent-map shows respectable stability due to its sharded mutex approach.
Notably, alphadose/haxmap suffers a steep decline under write pressure because its lazy deletion strategy introduces contention on the hash index.
Allocation Behavior
All libraries report zero allocations per operation for pure read/write mixes, except for sync.Map, which incurs a modest allocation cost on writes. xsync.Map achieves the lowest allocation footprint among non‑sharded designs, making it ideal for latency‑sensitive services.
Range Queries Under Contention
When a background goroutine continuously mutates the map while all workers iterate over it, the results shift dramatically:
- sync.Map and xsync.Map maintain relatively stable iteration throughput.
- orcaman/concurrent-map experiences the steepest drop due to its channel‑based iteration API.
Summary Table (Selected Results)
| Library | 100 % Reads | 90 % Reads | 75 % Reads | Allocations (B/op) |
|---|---|---|---|---|
| sync.Map | ≈1.2 M ops/s | ≈0.9 M ops/s | ≈0.6 M ops/s | ≈12 B/op (writes) |
| xsync.Map | ≈1.15 M ops/s | ≈1.0 M ops/s | ≈0.85 M ops/s | 0 B/op |
| orcaman/concurrent-map | ≈0.9 M ops/s | ≈0.7 M ops/s | ≈0.55 M ops/s | 0 B/op |
Implications for Go Developers
Understanding the benchmark outcomes equips developers with concrete decision criteria when selecting a concurrent map for production services.
When to Choose sync.Map
If your workload is overwhelmingly read‑heavy (≥99 % reads) and you prefer a zero‑dependency solution, sync.Map offers the best out‑of‑the‑box performance, especially on Go 1.24+ where the hash‑trie implementation shines.
When xsync.Map Is the Sweet Spot
For mixed read/write workloads (90 %–75 % reads) where latency matters, xsync.Map delivers the highest throughput with zero allocations. Its cache‑line‑aware bucket layout also reduces false sharing on multi‑core CPUs.
When Sharded Maps Like orcaman/concurrent-map Make Sense
If you need deterministic memory usage and a simple API, the sharded design is attractive. It scales predictably up to the number of shards (32 by default) and incurs no per‑operation allocations.
Avoiding Pitfalls with Lock‑Free Designs
Both cornelk/hashmap and alphadose/haxmap excel in niche scenarios (small maps, read‑only bursts) but degrade sharply under heavy writes or large map sizes. Use them only when you have a clear write‑light profile.
Strategic Takeaways for High‑Performance Services
- Profile your actual read/write mix before committing to a library.
- Consider the memory hierarchy: maps that fit in L1/L2 cache (< 1 000 entries) behave differently from those spilling to RAM.
- Leverage Go’s built‑in race detector and
pprofto validate that the chosen map does not introduce hidden contention.
Conclusion and Call‑to‑Action
The go-concurrent-map-bench repository equips the Go community with the data needed to make evidence‑based decisions about concurrent map implementations. By aligning your choice with the benchmark’s findings, you can reduce latency, lower CPU usage, and improve overall system scalability.
Ready to accelerate your own AI‑driven projects? Explore the UBOS homepage for a unified platform that streamlines AI workflow automation. Dive deeper into the UBOS platform overview to see how its modular architecture can host your Go services alongside powerful AI agents.
Need marketing intelligence? Our AI marketing agents can generate copy, analyze SEO, and even run performance tests similar to the ones described here. Check the UBOS pricing plans to find a tier that matches your startup budget.
For early‑stage innovators, the UBOS for startups program offers credits and mentorship. SMBs can benefit from UBOS solutions for SMBs, while enterprises may explore the Enterprise AI platform by UBOS for large‑scale deployments.
Build, test, and iterate faster with the Web app editor on UBOS or automate complex pipelines using the Workflow automation studio. Join the UBOS partner program to co‑create solutions that leverage the same performance‑first mindset demonstrated by the go-concurrent-map-bench suite.
Stay ahead of the curve—benchmark, choose wisely, and let your Go applications scale without bottlenecks.