05ca34093b
When running a benchmark multiple times, instead of re-computing the value of b.N each time, use the value found by the first run. For go test -bench=. -benchtime 3s -count 2 p_test.go on the benchmark in the linked issue; before: BenchmarkBenchmark-4 500 10180593 ns/op --- BENCH: BenchmarkBenchmark-4 p_test.go:13: single call took 10.111079ms p_test.go:13: single call took 1.017298685s p_test.go:13: single call took 5.090096124s BenchmarkBenchmark-4 500 10182164 ns/op --- BENCH: BenchmarkBenchmark-4 p_test.go:13: single call took 10.098169ms p_test.go:13: single call took 1.017712905s p_test.go:13: single call took 5.090898517s PASS ok command-line-arguments 12.244s and after: BenchmarkBenchmark-4 500 10177076 ns/op --- BENCH: BenchmarkBenchmark-4 p_test.go:13: single call took 10.091301ms p_test.go:13: single call took 1.016943125s p_test.go:13: single call took 5.088376028s BenchmarkBenchmark-4 500 10171497 ns/op --- BENCH: BenchmarkBenchmark-4 p_test.go:13: single call took 10.140245ms p_test.go:13: single call took 5.085605921s PASS ok command-line-arguments 11.218s Fixes #23423 Change-Id: Ie66a8c5ac43881eb8741e14105db28745b4d56d3 Reviewed-on: https://go-review.googlesource.com/110775 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> |
||
---|---|---|
.github | ||
api | ||
doc | ||
lib/time | ||
misc | ||
src | ||
test | ||
.gitattributes | ||
.gitignore | ||
AUTHORS | ||
CONTRIBUTING.md | ||
CONTRIBUTORS | ||
favicon.ico | ||
LICENSE | ||
PATENTS | ||
README.md | ||
robots.txt |
The Go Programming Language
Go is an open source programming language that makes it easy to build simple, reliable, and efficient software.
Gopher image by Renee French, licensed under Creative Commons 3.0 Attributions license.
Our canonical Git repository is located at https://go.googlesource.com/go. There is a mirror of the repository at https://github.com/golang/go.
Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
Download and Install
Binary Distributions
Official binary distributions are available at https://golang.org/dl/.
After downloading a binary release, visit https://golang.org/doc/install or load doc/install.html in your web browser for installation instructions.
Install From Source
If a binary distribution is not available for your combination of operating system and architecture, visit https://golang.org/doc/install/source or load doc/install-source.html in your web browser for source installation instructions.
Contributing
Go is the work of thousands of contributors. We appreciate your help!
To contribute, please read the contribution guidelines: https://golang.org/doc/contribute.html
Note that the Go project uses the issue tracker for bug reports and proposals only. See https://golang.org/wiki/Questions for a list of places to ask questions about the Go language.