From 0f0584a8050f2a622cea755a3c6b07c034ef182a Mon Sep 17 00:00:00 2001 From: Patrick Mylund Nielsen Date: Fri, 22 Jun 2012 06:52:32 +0100 Subject: [PATCH] Fix BenchmarkCacheSetDeleteSingleLock 'cheating' by unintentionally only locking once in the whole benchmark, rather than once per set and delete --- cache_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cache_test.go b/cache_test.go index 798d92e..2fdcb82 100644 --- a/cache_test.go +++ b/cache_test.go @@ -735,12 +735,12 @@ func BenchmarkMutexMapSetDelete(b *testing.B) { func BenchmarkCacheSetDeleteSingleLock(b *testing.B) { tc := New(0, 0) - tc.mu.Lock() for i := 0; i < b.N; i++ { + tc.mu.Lock() tc.set("foo", "bar", 0) tc.delete("foo") + tc.mu.Unlock() } - tc.mu.Unlock() } func BenchmarkMutexMapSetDeleteSingleLock(b *testing.B) {