Add BenchmarkRWMutexInterfaceMapGetString

master
Patrick Mylund Nielsen 9 years ago
parent 8c41258ef3
commit 721cc9438c

@ -1457,7 +1457,7 @@ func BenchmarkRWMutexMapGet(b *testing.B) {
}
}
func BenchmarkRWMutexInterfaceMapGet(b *testing.B) {
func BenchmarkRWMutexInterfaceMapGetStruct(b *testing.B) {
b.StopTimer()
s := struct{name string}{name: "foo"}
m := map[interface{}]string{
@ -1472,6 +1472,20 @@ func BenchmarkRWMutexInterfaceMapGet(b *testing.B) {
}
}
func BenchmarkRWMutexInterfaceMapGetString(b *testing.B) {
b.StopTimer()
m := map[interface{}]string{
"foo": "bar",
}
mu := sync.RWMutex{}
b.StartTimer()
for i := 0; i < b.N; i++ {
mu.RLock()
_, _ = m["foo"]
mu.RUnlock()
}
}
func BenchmarkCacheGetConcurrentExpiring(b *testing.B) {
benchmarkCacheGetConcurrent(b, 5*time.Minute)
}

Loading…
Cancel
Save