Fix BenchmarkCacheSetDeleteSingleLock 'cheating' by unintentionally only locking once in the whole benchmark, rather than once per set and delete

This commit is contained in:
Patrick Mylund Nielsen 2012-06-22 06:52:32 +01:00
parent 0a962bf9eb
commit 0f0584a805
1 changed files with 2 additions and 2 deletions

View File

@ -735,13 +735,13 @@ 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()
}
}
func BenchmarkMutexMapSetDeleteSingleLock(b *testing.B) {
m := map[string]string{}