Commit 727e5ce9 authored by Shenghou Ma's avatar Shenghou Ma

testing: update package docs to use ResetTimer() instead of StopTimer/StartTimer()

R=golang-dev, rsc, r
CC=golang-dev
https://golang.org/cl/6591051
parent 7f4b4c0c
...@@ -27,15 +27,14 @@ ...@@ -27,15 +27,14 @@
// //
// The benchmark package will vary b.N until the benchmark function lasts // The benchmark package will vary b.N until the benchmark function lasts
// long enough to be timed reliably. The output // long enough to be timed reliably. The output
// testing.BenchmarkHello 10000000 282 ns/op // BenchmarkHello 10000000 282 ns/op
// means that the loop ran 10000000 times at a speed of 282 ns per loop. // means that the loop ran 10000000 times at a speed of 282 ns per loop.
// //
// If a benchmark needs some expensive setup before running, the timer // If a benchmark needs some expensive setup before running, the timer
// may be stopped: // may be reset:
// func BenchmarkBigLen(b *testing.B) { // func BenchmarkBigLen(b *testing.B) {
// b.StopTimer()
// big := NewBig() // big := NewBig()
// b.StartTimer() // b.ResetTimer()
// for i := 0; i < b.N; i++ { // for i := 0; i < b.N; i++ {
// big.Len() // big.Len()
// } // }
......
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