Skip to content

Commit f09d045

Browse files
committed
regexp: don't run slow benchmarks on race builders
Shave 6.5 minutes off the *-race build time. The *-race builders run: go test -short -race -run=^$ -benchtime=.1s -cpu=4 $PKG ... for each package with benchmarks. The point isn't to measure the speed of the packages, but rather to see if there are any races. (which is why a benchtime of 0.1 seconds is used) But running in race mode makes things slower and our benchmarks aren't all very fast to begin with. The regexp benchmarks in race were taking over 6.5 minutes. With this CL, it's now 8 seconds. Updates #17104 Change-Id: I054528d09b1568d37aac9f9b515d6ed90a5cf5b0 Reviewed-on: https://go-review.googlesource.com/29156 Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: David Crawshaw <[email protected]>
1 parent 167e381 commit f09d045

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/regexp/exec_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"bufio"
99
"compress/bzip2"
1010
"fmt"
11+
"internal/testenv"
1112
"io"
1213
"os"
1314
"path/filepath"
@@ -659,9 +660,14 @@ func makeText(n int) []byte {
659660
}
660661

661662
func BenchmarkMatch(b *testing.B) {
663+
isRaceBuilder := strings.HasSuffix(testenv.Builder(), "-race")
664+
662665
for _, data := range benchData {
663666
r := MustCompile(data.re)
664667
for _, size := range benchSizes {
668+
if isRaceBuilder && size.n > 1<<10 {
669+
continue
670+
}
665671
t := makeText(size.n)
666672
b.Run(data.name+"/"+size.name, func(b *testing.B) {
667673
b.SetBytes(int64(size.n))

0 commit comments

Comments
 (0)