Add BenchmarkRWMutexInterfaceMapGet

This commit is contained in:
Patrick Mylund Nielsen 2015-12-03 09:40:14 -05:00
parent faf83836bd
commit 8c41258ef3
1 changed files with 15 additions and 0 deletions

View File

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