Fix BenchmarkCacheSetDeleteSingleLock 'cheating' by unintentionally only locking once in the whole benchmark, rather than once per set and delete
This commit is contained in:
parent
0a962bf9eb
commit
0f0584a805
|
@ -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{}
|
||||
|
|
Loading…
Reference in New Issue