We now get more than just time/op.
name time/op
Print-16 6.29ms ± 3%
name speed
Print-16 8.25MB/s ± 3%
name alloc/op
Print-16 483kB ± 0%
name allocs/op
Print-16 17.8k ± 0%
Change-Id: I6b5e9a30a826ff8603724bd5983e6b7f5ec12708
Reviewed-on: https://go-review.googlesource.com/c/go/+/412554
Reviewed-by: Robert Griesemer <gri@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Robert Griesemer <gri@google.com>
Auto-Submit: Robert Griesemer <gri@google.com>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Ian Lance Taylor <iant@google.com>
"testing"
)
-var testfile *ast.File
+var (
+ testfile *ast.File
+ testsize int64
+)
func testprint(out io.Writer, file *ast.File) {
if err := (&Config{TabIndent | UseSpaces | normalizeNumbers, 8, 0}).Fprint(out, fset, file); err != nil {
}
testfile = file
+ testsize = int64(len(src))
}
func BenchmarkPrint(b *testing.B) {
if testfile == nil {
initialize()
}
+ b.ReportAllocs()
+ b.SetBytes(testsize)
for i := 0; i < b.N; i++ {
testprint(io.Discard, testfile)
}