Merge branch 'master' of https://github.com/patrickmn/go-cache
This commit is contained in:
commit
3eb91e81eb
|
@ -1457,6 +1457,35 @@ func BenchmarkRWMutexMapGet(b *testing.B) {
|
|||
}
|
||||
}
|
||||
|
||||
func BenchmarkRWMutexInterfaceMapGetStruct(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 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…
Reference in New Issue