summaryrefslogtreecommitdiffstats
path: root/llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go')
-rw-r--r--llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go b/llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go
index 119eb3f39c7..ac93119d77d 100644
--- a/llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go
+++ b/llgo/third_party/gofrontend/libgo/go/runtime/mapspeed_test.go
@@ -234,6 +234,15 @@ func BenchmarkNewEmptyMap(b *testing.B) {
}
}
+func BenchmarkNewSmallMap(b *testing.B) {
+ b.ReportAllocs()
+ for i := 0; i < b.N; i++ {
+ m := make(map[int]int)
+ m[0] = 0
+ m[1] = 1
+ }
+}
+
func BenchmarkMapIter(b *testing.B) {
m := make(map[int]bool)
for i := 0; i < 8; i++ {
@@ -298,3 +307,22 @@ func BenchmarkSmallKeyMap(b *testing.B) {
_ = m[5]
}
}
+
+type ComplexAlgKey struct {
+ a, b, c int64
+ _ int
+ d int32
+ _ int
+ e string
+ _ int
+ f, g, h int64
+}
+
+func BenchmarkComplexAlgMap(b *testing.B) {
+ m := make(map[ComplexAlgKey]bool)
+ var k ComplexAlgKey
+ m[k] = true
+ for i := 0; i < b.N; i++ {
+ _ = m[k]
+ }
+}
OpenPOWER on IntegriCloud