Commit da833474 authored by Roger Peppe's avatar Roger Peppe Committed by Rob Pike

testing: run GC before each benchmark run.

R=r, rh, gri, rsc
CC=golang-dev
https://golang.org/cl/4237055
parent 5bd284e8
......@@ -8,6 +8,7 @@ import (
"flag"
"fmt"
"os"
"runtime"
"time"
)
......@@ -64,6 +65,9 @@ func (b *B) nsPerOp() int64 {
// runN runs a single benchmark for the specified number of iterations.
func (b *B) runN(n int) {
// Try to get a comparable environment for each run
// by clearing garbage from previous runs.
runtime.GC()
b.N = n
b.ResetTimer()
b.StartTimer()
......
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