aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/mapspeed_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/mapspeed_test.go')
-rw-r--r--src/pkg/runtime/mapspeed_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/pkg/runtime/mapspeed_test.go b/src/pkg/runtime/mapspeed_test.go
index 13b57621d4..d643d98985 100644
--- a/src/pkg/runtime/mapspeed_test.go
+++ b/src/pkg/runtime/mapspeed_test.go
@@ -254,3 +254,17 @@ func BenchmarkMapIterEmpty(b *testing.B) {
}
}
}
+
+func BenchmarkSameLengthMap(b *testing.B) {
+ // long strings, same length, differ in first few
+ // and last few bytes.
+ m := make(map[string]bool)
+ s1 := "foo" + strings.Repeat("-", 100) + "bar"
+ s2 := "goo" + strings.Repeat("-", 100) + "ber"
+ m[s1] = true
+ m[s2] = true
+ b.ResetTimer()
+ for i := 0; i < b.N; i++ {
+ _ = m[s1]
+ }
+}