From: Michael Pratt Date: Tue, 29 Oct 2024 19:32:09 +0000 (-0400) Subject: runtime: skip most map benchmark combinations by default X-Git-Tag: go1.24rc1~548 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=0c934b5645c3220de21a5733c60c81e46d06d4e3;p=gostls13.git runtime: skip most map benchmark combinations by default 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 Auto-Submit: Michael Pratt LUCI-TryBot-Result: Go LUCI --- diff --git a/src/runtime/map_benchmark_test.go b/src/runtime/map_benchmark_test.go index 6f527c3af6..3b83de59cd 100644 --- a/src/runtime/map_benchmark_test.go +++ b/src/runtime/map_benchmark_test.go @@ -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) }) }