@@ -19,37 +19,37 @@ goos: darwin
1919goarch: arm64
2020pkg: github.com/go-pkgz/expirable-cache/benchmarks
2121cpu: Apple M3
22- BenchmarkGoCache_Set-8 13150846 84.63 ns/op 68 B/op 1 allocs/op
23- BenchmarkGoCache_Get-8 17746971 66.29 ns/op 3 B/op 0 allocs/op
24- BenchmarkGoCache_SetAndGet-8 17334808 68.97 ns/op 36 B/op 1 allocs/op
25- BenchmarkTTLCache_Set-8 2818526 430.7 ns/op 4 B/op 0 allocs/op
26- BenchmarkTTLCache_Get-8 6197169 193.1 ns/op 51 B/op 1 allocs/op
27- BenchmarkTTLCache_SetAndGet-8 4923871 242.8 ns/op 28 B/op 1 allocs/op
28- BenchmarkExpirableCache_Set-8 17001220 69.65 ns/op 4 B/op 0 allocs/op
29- BenchmarkExpirableCache_Get-8 15427915 78.27 ns/op 3 B/op 0 allocs/op
30- BenchmarkExpirableCache_SetAndGet-8 17600006 67.69 ns/op 4 B/op 0 allocs/op
31- BenchmarkRistretto_Set-8 1502190 793.8 ns/op 262 B/op 5 allocs/op
32- BenchmarkRistretto_Get-8 14158246 82.61 ns/op 27 B/op 2 allocs/op
33- BenchmarkRistretto_SetAndGet-8 6852046 197.6 ns/op 96 B/op 2 allocs/op
34- BenchmarkGoCache_GetWithTypeAssertion-8 17942817 67.64 ns/op 3 B/op 0 allocs/op
35- BenchmarkTTLCache_GetWithoutTypeAssertion-8 6029751 199.0 ns/op 51 B/op 1 allocs/op
36- BenchmarkExpirableCache_GetWithoutTypeAssertion-8 15133410 79.33 ns/op 3 B/op 0 allocs/op
37- BenchmarkRistretto_GetWithTypeAssertion-8 14187883 86.12 ns/op 27 B/op 2 allocs/op
38- BenchmarkGoCache_RealWorldScenario-8 16314248 70.60 ns/op 4 B/op 0 allocs/op
39- BenchmarkTTLCache_RealWorldScenario-8 5891400 200 .0 ns/op 52 B/op 1 allocs/op
40- BenchmarkExpirableCache_RealWorldScenario-8 14579878 79.98 ns/op 3 B/op 0 allocs/op
41- BenchmarkRistretto_RealWorldScenario-8 12897400 85.88 ns/op 28 B/op 2 allocs/op
22+ BenchmarkGoCache_Set-8 12169099 82.67 ns/op 68 B/op 1 allocs/op
23+ BenchmarkGoCache_Get-8 18444500 63.81 ns/op 3 B/op 0 allocs/op
24+ BenchmarkGoCache_SetAndGet-8 17692840 67.94 ns/op 36 B/op 1 allocs/op
25+ BenchmarkTTLCache_Set-8 2707100 448.8 ns/op 5 B/op 0 allocs/op
26+ BenchmarkTTLCache_Get-8 6269760 190.9 ns/op 51 B/op 1 allocs/op
27+ BenchmarkTTLCache_SetAndGet-8 4806730 253.9 ns/op 28 B/op 1 allocs/op
28+ BenchmarkExpirableCache_Set-8 17192541 69.14 ns/op 4 B/op 0 allocs/op
29+ BenchmarkExpirableCache_Get-8 15239731 78.12 ns/op 3 B/op 0 allocs/op
30+ BenchmarkExpirableCache_SetAndGet-8 17954317 66.62 ns/op 4 B/op 0 allocs/op
31+ BenchmarkRistretto_Set-8 1456555 820.0 ns/op 262 B/op 5 allocs/op
32+ BenchmarkRistretto_Get-8 14321246 84.23 ns/op 27 B/op 2 allocs/op
33+ BenchmarkRistretto_SetAndGet-8 5989928 198.2 ns/op 96 B/op 2 allocs/op
34+ BenchmarkGoCache_GetWithTypeAssertion-8 17971783 66.44 ns/op 3 B/op 0 allocs/op
35+ BenchmarkTTLCache_GetWithoutTypeAssertion-8 6114782 197.9 ns/op 51 B/op 1 allocs/op
36+ BenchmarkExpirableCache_GetWithoutTypeAssertion-8 15095240 78.39 ns/op 3 B/op 0 allocs/op
37+ BenchmarkRistretto_GetWithTypeAssertion-8 14458339 83.09 ns/op 27 B/op 2 allocs/op
38+ BenchmarkGoCache_RealWorldScenario-8 16622580 70.24 ns/op 4 B/op 0 allocs/op
39+ BenchmarkTTLCache_RealWorldScenario-8 6038209 198 .0 ns/op 52 B/op 1 allocs/op
40+ BenchmarkExpirableCache_RealWorldScenario-8 14718102 78.83 ns/op 3 B/op 0 allocs/op
41+ BenchmarkRistretto_RealWorldScenario-8 13030276 83.40 ns/op 28 B/op 2 allocs/op
4242```
4343
4444## Summary of Results
4545
4646| Operation | [ go-pkgz/expirable-cache] ( https://github.com/go-pkgz/expirable-cache ) | [ patrickmn/go-cache] ( https://github.com/patrickmn/go-cache ) | [ jellydator/ttlcache] ( https://github.com/jellydator/ttlcache ) | [ dgraph-io/ristretto] ( https://github.com/dgraph-io/ristretto ) |
4747| -----------| -----------------| ----------| ----------| -----------|
48- | Set | 69.65 ns/op | 84.63 ns/op | 430.7 ns/op | 793.8 ns/op |
49- | Get | 78.27 ns/op | 66.29 ns/op | 193.1 ns/op | 82.61 ns/op |
50- | Set+Get | 67.69 ns/op | 68.97 ns/op | 242.8 ns/op | 197.6 ns/op |
51- | Real-world scenario | 79.98 ns/op | 70.60 ns/op | 200 .0 ns/op | 85.88 ns/op |
52- | Memory allocations (Set) | 4 B/op | 68 B/op | 4 B/op | 262 B/op |
48+ | Set | 69.14 ns/op | 82.67 ns/op | 448.8 ns/op | 820.0 ns/op |
49+ | Get | 78.12 ns/op | 63.81 ns/op | 190.9 ns/op | 84.23 ns/op |
50+ | Set+Get | 66.62 ns/op | 67.94 ns/op | 253.9 ns/op | 198.2 ns/op |
51+ | Real-world scenario | 78.83 ns/op | 70.24 ns/op | 198 .0 ns/op | 83.40 ns/op |
52+ | Memory allocations (Set) | 4 B/op | 68 B/op | 5 B/op | 262 B/op |
5353| Memory allocations (Get) | 3 B/op | 3 B/op | 51 B/op | 27 B/op |
5454
5555## Analysis
0 commit comments