Commit 9b807915 authored by Keith Randall's avatar Keith Randall Committed by Keith Randall

regexp: skip long-running benchmarks if -short is specified

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: default avatarBrad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent dc72a2f9
...@@ -665,7 +665,7 @@ func BenchmarkMatch(b *testing.B) { ...@@ -665,7 +665,7 @@ func BenchmarkMatch(b *testing.B) {
for _, data := range benchData { for _, data := range benchData {
r := MustCompile(data.re) r := MustCompile(data.re)
for _, size := range benchSizes { for _, size := range benchSizes {
if isRaceBuilder && size.n > 1<<10 { if (isRaceBuilder || testing.Short()) && size.n > 1<<10 {
continue continue
} }
t := makeText(size.n) t := makeText(size.n)
...@@ -688,7 +688,7 @@ func BenchmarkMatch_onepass_regex(b *testing.B) { ...@@ -688,7 +688,7 @@ func BenchmarkMatch_onepass_regex(b *testing.B) {
b.Fatalf("want onepass regex, but %q is not onepass", r) b.Fatalf("want onepass regex, but %q is not onepass", r)
} }
for _, size := range benchSizes { for _, size := range benchSizes {
if isRaceBuilder && size.n > 1<<10 { if (isRaceBuilder || testing.Short()) && size.n > 1<<10 {
continue continue
} }
t := makeText(size.n) t := makeText(size.n)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment