Skip to content

Commit dbf533a

Browse files
committed
encoding/json: make BenchmarkSkipValue more stable
BenchmarkSkipValue was sensitive to the value of b.N due to its significant startup cost. Two adjacent runs before this CL: BenchmarkSkipValue 50 21047499 ns/op 93.37 MB/s BenchmarkSkipValue 100 17260554 ns/op 118.05 MB/s After this CL, using benchtime to recreate the difference in b.N: BenchmarkSkipValue 50 15204797 ns/op 131.67 MB/s BenchmarkSkipValue 100 15332319 ns/op 130.58 MB/s Change-Id: Iac86f86dd774d535302fa5e4c08f89f8da00be9e Reviewed-on: https://go-review.googlesource.com/10053 Reviewed-by: Andrew Gerrand <[email protected]>
1 parent ef54930 commit dbf533a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/encoding/json/scanner_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ var benchScan scanner
209209

210210
func BenchmarkSkipValue(b *testing.B) {
211211
initBig()
212+
b.ResetTimer()
212213
for i := 0; i < b.N; i++ {
213214
nextValue(jsonBig, &benchScan)
214215
}

0 commit comments

Comments
 (0)