From 50365666c7264ac0608220adeff2c4f503b8fb67 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 13 Jun 2014 02:04:03 -0400 Subject: [PATCH] undo CL 101970047 / 30307cc8bef2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit makes windows-amd64-race benchmarks slower ««« original CL description testing: make benchmarking faster Allow the number of benchmark iterations to grow faster for fast benchmarks, and don't round up twice. Using the default benchtime, this CL reduces wall clock time to run benchmarks: net/http 49s -> 37s (-24%) runtime 8m31s -> 5m55s (-30%) bytes 2m37s -> 1m29s (-43%) encoding/json 29s -> 21s (-27%) strings 1m16s -> 53s (-30%) LGTM=crawshaw R=golang-codereviews, crawshaw CC=golang-codereviews https://golang.org/cl/101970047 »»» TBR=josharian CC=golang-codereviews https://golang.org/cl/105950044 --- src/pkg/testing/benchmark.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pkg/testing/benchmark.go b/src/pkg/testing/benchmark.go index 43bbecbdc6..1fbf5c8615 100644 --- a/src/pkg/testing/benchmark.go +++ b/src/pkg/testing/benchmark.go @@ -205,12 +205,10 @@ func (b *B) launch() { } else { n = int(d.Nanoseconds() / b.nsPerOp()) } - // If the last run was small, don't grow too fast. - if last < 1000 { - n = min(n, 100*last) - } + // Run more iterations than we think we'll need for a second (1.5x). + // Don't grow too fast in case we had timing errors previously. // Be sure to run at least one more than last time. - n = max(n, last+1) + n = max(min(n+n/2, 100*last), last+1) // Round up to something easy to read. n = roundUp(n) b.runN(n) -- 2.48.1