From 7629f48824b99f757d28ea007422d5a7f435d1f4 Mon Sep 17 00:00:00 2001 From: "xiangyu.lu" Date: Wed, 3 Jan 2024 12:15:44 +0800 Subject: [PATCH] adjust bench tests to Read(90%)/Write(10%) --- bench/bench_test.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bench/bench_test.go b/bench/bench_test.go index b684608..fe03899 100644 --- a/bench/bench_test.go +++ b/bench/bench_test.go @@ -46,7 +46,7 @@ func BenchmarkCloudflareGet(b *testing.B) { expires := time.Now().Add(time.Hour) for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.Set(keymap[i], i, expires) @@ -65,7 +65,7 @@ func BenchmarkEcacheGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.Put(keymap[i], i) @@ -90,7 +90,7 @@ func BenchmarkRistrettoGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.SetWithTTL(keymap[i], i, 1, time.Hour) @@ -111,7 +111,7 @@ func BenchmarkTheineGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.SetWithTTL(keymap[i], i, 1, time.Hour) @@ -132,7 +132,7 @@ func BenchmarkOtterGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.SetWithTTL(keymap[i], i, time.Hour) @@ -157,7 +157,7 @@ func BenchmarkFreelruGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.AddWithLifetime(keymap[i], i, time.Hour) @@ -178,7 +178,7 @@ func BenchmarkPhusluGet(b *testing.B) { b.RunParallel(func(pb *testing.PB) { for pb.Next() { i := int(fastrandn(cachesize)) - if i >= cachesize/4 { + if i >= cachesize/10 { cache.Get(keymap[i]) } else { cache.SetWithTTL(keymap[i], i, time.Hour)