From 7f1016551c924aa7e44dae4c2836ec7beb602ab8 Mon Sep 17 00:00:00 2001 From: Giuseppe Date: Tue, 1 Dec 2015 22:31:59 +0100 Subject: [PATCH] modified test --- cache_test.go | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/cache_test.go b/cache_test.go index 4333af4..8586253 100644 --- a/cache_test.go +++ b/cache_test.go @@ -1648,16 +1648,41 @@ func BenchmarkDeleteExpiredLoop(b *testing.B) { } } -func BenchmarkLargeCache(b *testing.B) { +func BenchmarkLargeCache01(b *testing.B) { + benchmarkLargeCache(b, 100000) +} + +func BenchmarkLargeCache02(b *testing.B) { + benchmarkLargeCache(b, 200000) +} + +func BenchmarkLargeCache05(b *testing.B) { + benchmarkLargeCache(b, 500000) +} + +func BenchmarkLargeCache10(b *testing.B) { + benchmarkLargeCache(b, 1000000) +} + +func BenchmarkLargeCache20(b *testing.B) { + benchmarkLargeCache(b, 2000000) +} + +func BenchmarkLargeCache50(b *testing.B) { + benchmarkLargeCache(b, 5000000) +} + +func benchmarkLargeCache(b *testing.B, nano int) { b.StopTimer() - tc := New(100*time.Millisecond, 5*time.Millisecond) + tc := New(100*time.Millisecond, time.Duration(nano)*time.Nanosecond) b.StartTimer() - b.N = 10000000 + b.N = 1000000 for i := 0; i < b.N; i++ { tc.Set(strconv.Itoa(i), "bar", DefaultExpiration) } } + /* func BenchmarkLargeCache(b *testing.B) { b.StopTimer()