reflect: remove the Map benchmarks
They were initially added just as a test, but they've proven to be noisy
and low signal. Remove them.
This CL explicitly leaves behind the "go test" mode of cmd/bench so we
can easily add other "go test" benchmarks back. Right now it just won't
find anything, which is fine.
For #58534.
Change-Id: I60aa8fee3157d83dbabe58e8cefd28aeb2dbf6ec
Reviewed-on: https://go-review.googlesource.com/c/benchmarks/+/468557
Run-TryBot: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
diff --git a/reflect/reflect_test.go b/reflect/reflect_test.go
deleted file mode 100644
index f02be3e..0000000
--- a/reflect/reflect_test.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2009 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package reflect_test
-
-import (
- "fmt"
- "reflect"
- "testing"
-)
-
-// BenchmarkMap is a copy of reflect_test.BenchmarkMap from the Go standard
-// library, placed here for basic benchmarking testing.
-func BenchmarkMap(b *testing.B) {
- type V *int
- value := reflect.ValueOf((V)(nil))
- stringKeys := []string{}
- mapOfStrings := map[string]V{}
- uint64Keys := []uint64{}
- mapOfUint64s := map[uint64]V{}
- for i := 0; i < 100; i++ {
- stringKey := fmt.Sprintf("key%d", i)
- stringKeys = append(stringKeys, stringKey)
- mapOfStrings[stringKey] = nil
-
- uint64Key := uint64(i)
- uint64Keys = append(uint64Keys, uint64Key)
- mapOfUint64s[uint64Key] = nil
- }
-
- tests := []struct {
- label string
- m, keys, value reflect.Value
- }{
- {"StringKeys", reflect.ValueOf(mapOfStrings), reflect.ValueOf(stringKeys), value},
- {"Uint64Keys", reflect.ValueOf(mapOfUint64s), reflect.ValueOf(uint64Keys), value},
- }
-
- for _, tt := range tests {
- b.Run(tt.label, func(b *testing.B) {
- b.Run("MapIndex", func(b *testing.B) {
- b.ReportAllocs()
- for i := 0; i < b.N; i++ {
- for j := tt.keys.Len() - 1; j >= 0; j-- {
- tt.m.MapIndex(tt.keys.Index(j))
- }
- }
- })
- b.Run("SetMapIndex", func(b *testing.B) {
- b.ReportAllocs()
- for i := 0; i < b.N; i++ {
- for j := tt.keys.Len() - 1; j >= 0; j-- {
- tt.m.SetMapIndex(tt.keys.Index(j), tt.value)
- }
- }
- })
- })
- }
-}