Skip to content

Commit ac2bda0

Browse files
committed
use xsync.Map for flightgroups instead of sharding
1 parent eb9503f commit ac2bda0

8 files changed

Lines changed: 490 additions & 2760 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,7 @@ go.work.sum
3636

3737
# added by lint-install
3838
out/
39+
40+
gocachemark_results.html
41+
benchmarks/gocachemark_results.html
42+

README.md

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,26 +58,21 @@ For maximum efficiency, all backends support S2 or Zstd compression via `pkg/sto
5858

5959
## Performance
6060

61-
62-
[gocachemark](https://github.com/tstromberg/gocachemark) compares cache libraries across hit rate, latency, throughput, and memory. Overall scores (Dec 2025):
63-
64-
```
65-
#1 multicache 160 points (13 gold, 3 silver, 1 bronze)
66-
#2 otter 80 points
67-
#3 clock 70 points
68-
```
61+
multicache has been exhaustively tested for performance using [gocachemark](https://github.com/tstromberg/gocachemark). As of Dec 2025, it's the highest performing cache implementation for Go.
6962

7063
Where multicache wins:
7164

72-
- **Hit rate**: Wins 6 of 9 production traces. +4.9% on Meta, +4.1% on Tencent Photo, +1.6% on Wikipedia
73-
- **Throughput**: 12x faster Set, 1.6x faster Get vs otter at 32 threads
74-
- **Latency**: 9-11ns Get, zero allocations
65+
- **Throughput**: 1 billion ints/second at 16 threads or higher. (2-3X faster than otter)
66+
- **Hit rate**: Highest average across datasets (1.6% higher than sieve, 4.4% higher than otter)
67+
- **Latency**: 9-11ns Get, zero allocations (3-4X lower latency than otter)
7568

7669
Where others win:
7770

7871
- **Memory**: freelru and otter use less memory per entry
7972
- **Some traces**: CLOCK/LRU marginally better on purely temporal workloads (IBM Docker, Thesios)
8073

74+
Much of the credit for high throughput goes to [puzpuzpuz/xsync](https://github.com/puzpuzpuz/xsync). While highly sharded maps and flightGroups performed well, you can't beat xsync's lock-free data structures.
75+
8176
Run `make competive-bench` for full results.
8277

8378
## Algorithm

0 commit comments

Comments
 (0)