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,12 +735,12 @@ func BenchmarkMutexMapSetDelete(b *testing.B) {
|
||||||
|
|
||||||
func BenchmarkCacheSetDeleteSingleLock(b *testing.B) {
|
func BenchmarkCacheSetDeleteSingleLock(b *testing.B) {
|
||||||
tc := New(0, 0)
|
tc := New(0, 0)
|
||||||
tc.mu.Lock()
|
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
|
tc.mu.Lock()
|
||||||
tc.set("foo", "bar", 0)
|
tc.set("foo", "bar", 0)
|
||||||
tc.delete("foo")
|
tc.delete("foo")
|
||||||
}
|
|
||||||
tc.mu.Unlock()
|
tc.mu.Unlock()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkMutexMapSetDeleteSingleLock(b *testing.B) {
|
func BenchmarkMutexMapSetDeleteSingleLock(b *testing.B) {
|
||||||
|
|
Loading…
Reference in New Issue