Commit a6106eef authored by Russ Cox's avatar Russ Cox

encoding/json: make BenchmarkSkipValue more consistent

Move scanner allocation out of loop.
It's the only allocation in the test so it dominates
when it triggers a garbage collection.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5369117
parent cb85e8ac
......@@ -186,11 +186,12 @@ func TestNextValueBig(t *testing.T) {
}
}
var benchScan scanner
func BenchmarkSkipValue(b *testing.B) {
initBig()
var scan scanner
for i := 0; i < b.N; i++ {
nextValue(jsonBig, &scan)
nextValue(jsonBig, &benchScan)
}
b.SetBytes(int64(len(jsonBig)))
}
......
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