]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: skip most map benchmark combinations by default
authorMichael Pratt <mpratt@google.com>
Tue, 29 Oct 2024 19:32:09 +0000 (15:32 -0400)
committerGopher Robot <gobot@golang.org>
Tue, 29 Oct 2024 20:04:40 +0000 (20:04 +0000)
Fixes #70008.

Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-race
Change-Id: I1fd7d1cbda20cc96016c864bcf0696382453e807
Reviewed-on: https://go-review.googlesource.com/c/go/+/623335
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/runtime/map_benchmark_test.go

index 6f527c3af65bc793079949372befe25d49cff0f6..3b83de59cdfd35ff550823474aabd2274e654fdb 100644 (file)
@@ -6,6 +6,7 @@ package runtime_test
 
 import (
        "encoding/binary"
+       "flag"
        "fmt"
        "math/rand"
        "runtime"
@@ -16,6 +17,8 @@ import (
        "unsafe"
 )
 
+var mapbench = flag.Bool("mapbench", false, "enable the full set of map benchmark variants")
+
 const size = 10
 
 func BenchmarkHashStringSpeed(b *testing.B) {
@@ -511,9 +514,24 @@ func benchSizes(f func(b *testing.B, n int)) func(*testing.B) {
                1 << 22,
        }
 
+       // Cases enabled by default. Set -mapbench for the remainder.
+       //
+       // With the other type combinations, there are literally thousands of
+       // variations. It take too long to run all of these as part of
+       // builders.
+       byDefault := map[int]bool{
+               6:       true,
+               64:      true,
+               1 << 16: true,
+       }
+
        return func(b *testing.B) {
                for _, n := range cases {
                        b.Run("len="+strconv.Itoa(n), func(b *testing.B) {
+                               if !*mapbench && !byDefault[n] {
+                                       b.Skip("Skipped because -mapbench=false")
+                               }
+
                                f(b, n)
                        })
                }