summaryrefslogtreecommitdiff
path: root/libgo/go/runtime/mapspeed_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/go/runtime/mapspeed_test.go')
-rw-r--r--libgo/go/runtime/mapspeed_test.go34
1 files changed, 32 insertions, 2 deletions
diff --git a/libgo/go/runtime/mapspeed_test.go b/libgo/go/runtime/mapspeed_test.go
index d643d98985..119eb3f39c 100644
--- a/libgo/go/runtime/mapspeed_test.go
+++ b/libgo/go/runtime/mapspeed_test.go
@@ -241,7 +241,7 @@ func BenchmarkMapIter(b *testing.B) {
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
- for _, _ = range m {
+ for range m {
}
}
}
@@ -250,7 +250,7 @@ func BenchmarkMapIterEmpty(b *testing.B) {
m := make(map[int]bool)
b.ResetTimer()
for i := 0; i < b.N; i++ {
- for _, _ = range m {
+ for range m {
}
}
}
@@ -268,3 +268,33 @@ func BenchmarkSameLengthMap(b *testing.B) {
_ = m[s1]
}
}
+
+type BigKey [3]int64
+
+func BenchmarkBigKeyMap(b *testing.B) {
+ m := make(map[BigKey]bool)
+ k := BigKey{3, 4, 5}
+ m[k] = true
+ for i := 0; i < b.N; i++ {
+ _ = m[k]
+ }
+}
+
+type BigVal [3]int64
+
+func BenchmarkBigValMap(b *testing.B) {
+ m := make(map[BigKey]BigVal)
+ k := BigKey{3, 4, 5}
+ m[k] = BigVal{6, 7, 8}
+ for i := 0; i < b.N; i++ {
+ _ = m[k]
+ }
+}
+
+func BenchmarkSmallKeyMap(b *testing.B) {
+ m := make(map[int16]bool)
+ m[5] = true
+ for i := 0; i < b.N; i++ {
+ _ = m[5]
+ }
+}