22
33This directory contains comparison benchmarks against popular Go cache libraries.
44
5+ ## Attribution
6+
7+ The throughput and hit ratio benchmarks are inspired by and adapted from:
8+ - [ go-cache-benchmark-plus] ( https://github.com/Yiling-J/go-cache-benchmark-plus ) by Yiling-J (theine-go author)
9+ - Original benchmark framework designed for comparing cache implementations
10+
511## ⚠️ Important Disclaimers
612
713### Cherrypicked Benchmarks
@@ -41,6 +47,39 @@ Other libraries require manual save/load of the entire cache, which:
4147
4248## Running Benchmarks
4349
50+ ### Parallel Throughput (go-cache-benchmark-plus style)
51+
52+ ``` bash
53+ # Run with varying CPU counts
54+ go test -bench=BenchmarkThroughput -benchmem -cpu=1,4,8,16
55+
56+ # Just Get operations
57+ go test -bench=BenchmarkThroughputGetParallel -benchmem -cpu=16
58+
59+ # Just Set operations
60+ go test -bench=BenchmarkThroughputSetParallel -benchmem -cpu=16
61+
62+ # Hot key contention test
63+ go test -bench=BenchmarkThroughputGetSingle -benchmem -cpu=16
64+ ```
65+
66+ ### Hit Ratio Tests (trace-based patterns)
67+
68+ ``` bash
69+ # Quick comparison for tuning
70+ go test -run=TestQuickHitRate -v
71+
72+ # Full trace-based hit ratio tests
73+ go test -run=TestTraceHitRate -v
74+
75+ # Individual trace patterns
76+ go test -run=TestTraceHitRateZipf -v # Zipf distribution
77+ go test -run=TestTraceHitRateDatabase -v # Database/ERP pattern
78+ go test -run=TestTraceHitRateSearch -v # Search engine pattern
79+ go test -run=TestTraceHitRateScan -v # Scan resistance test
80+ go test -run=TestTraceHitRateMixed -v # Mixed GET/SET workload
81+ ```
82+
4483### Speed Comparison
4584
4685``` bash
@@ -64,6 +103,8 @@ Runs the complete benchmark comparison including hit rates, latency, and concurr
64103## Benchmark Files
65104
66105- ` benchmark_test.go ` - Speed, hit rate, and throughput benchmarks across libraries
106+ - ` throughput_test.go ` - Parallel throughput benchmarks (go-cache-benchmark-plus style)
107+ - ` hitrate_trace_test.go ` - Hit ratio benchmarks using synthetic trace patterns
67108
68109## Interpreting Results
69110
0 commit comments