Add BenchmarkRWMutexInterfaceMapGetString
This commit is contained in:
+15
-1
@@ -1457,7 +1457,7 @@ func BenchmarkRWMutexMapGet(b *testing.B) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkRWMutexInterfaceMapGet(b *testing.B) {
|
func BenchmarkRWMutexInterfaceMapGetStruct(b *testing.B) {
|
||||||
b.StopTimer()
|
b.StopTimer()
|
||||||
s := struct{name string}{name: "foo"}
|
s := struct{name string}{name: "foo"}
|
||||||
m := map[interface{}]string{
|
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) {
|
func BenchmarkCacheGetConcurrentExpiring(b *testing.B) {
|
||||||
benchmarkCacheGetConcurrent(b, 5*time.Minute)
|
benchmarkCacheGetConcurrent(b, 5*time.Minute)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user