Skip to content

Commit

Permalink
adjust bench tests to Read(90%)/Write(10%)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyu.lu committed Jan 3, 2024
1 parent 7c656e9 commit 7629f48
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 7629f48

Please sign in to comment.