]> Cypherpunks.ru repositories - gostls13.git/commitdiff
regexp: skip long-running benchmarks if -short is specified
authorKeith Randall <khr@google.com>
Thu, 17 Oct 2019 19:31:53 +0000 (12:31 -0700)
committerKeith Randall <khr@golang.org>
Thu, 17 Oct 2019 19:53:52 +0000 (19:53 +0000)
This CL helps race.bash finish in a reasonable amount of
time. Otherwise the Match/Hard1/32M benchmark takes over 1200 seconds
to finish on arm64, triggering a timeout.  With this change the regexp
benchmarks as a whole take only about a minute.

Change-Id: Ie2260ef9f5709e32a74bd76f135bc384b2d9853f
Reviewed-on: https://go-review.googlesource.com/c/go/+/201742
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/regexp/exec_test.go

index 1e8795525d048c3c9dbdc7325c8590457eb8ac4b..1f9a7a96e0c67d5eeb9b479b973dc0698f17f86e 100644 (file)
@@ -665,7 +665,7 @@ func BenchmarkMatch(b *testing.B) {
        for _, data := range benchData {
                r := MustCompile(data.re)
                for _, size := range benchSizes {
-                       if isRaceBuilder && size.n > 1<<10 {
+                       if (isRaceBuilder || testing.Short()) && size.n > 1<<10 {
                                continue
                        }
                        t := makeText(size.n)
@@ -688,7 +688,7 @@ func BenchmarkMatch_onepass_regex(b *testing.B) {
                b.Fatalf("want onepass regex, but %q is not onepass", r)
        }
        for _, size := range benchSizes {
-               if isRaceBuilder && size.n > 1<<10 {
+               if (isRaceBuilder || testing.Short()) && size.n > 1<<10 {
                        continue
                }
                t := makeText(size.n)