File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1457,7 +1457,7 @@ func BenchmarkRWMutexMapGet(b *testing.B) {
1457
1457
}
1458
1458
}
1459
1459
1460
- func BenchmarkRWMutexInterfaceMapGet (b * testing.B ) {
1460
+ func BenchmarkRWMutexInterfaceMapGetStruct (b * testing.B ) {
1461
1461
b .StopTimer ()
1462
1462
s := struct {name string }{name : "foo" }
1463
1463
m := map [interface {}]string {
@@ -1472,6 +1472,20 @@ func BenchmarkRWMutexInterfaceMapGet(b *testing.B) {
1472
1472
}
1473
1473
}
1474
1474
1475
+ func BenchmarkRWMutexInterfaceMapGetString (b * testing.B ) {
1476
+ b .StopTimer ()
1477
+ m := map [interface {}]string {
1478
+ "foo" : "bar" ,
1479
+ }
1480
+ mu := sync.RWMutex {}
1481
+ b .StartTimer ()
1482
+ for i := 0 ; i < b .N ; i ++ {
1483
+ mu .RLock ()
1484
+ _ , _ = m ["foo" ]
1485
+ mu .RUnlock ()
1486
+ }
1487
+ }
1488
+
1475
1489
func BenchmarkCacheGetConcurrentExpiring (b * testing.B ) {
1476
1490
benchmarkCacheGetConcurrent (b , 5 * time .Minute )
1477
1491
}
You can’t perform that action at this time.
0 commit comments