go/printer, gofmt: 20 to 30% faster gofmt
Buffer intermediate output via a bytes.Buffer and thus avoid calling through the entire Writer stack for every item printed. There is more opportunity for improvements along the same lines. Before (best of 3 runs): - printer.BenchmarkPrint 50 47959760 ns/op - time gofmt -l $GOROOT/src real 0m11.517s After (best of 3 runs): - printer.BenchmarkPrint 50 32056640 ns/op (= -33%) - time gofmt -l $GOROOT/src real 0m9.070s (= -21%) R=r CC=golang-dev https://golang.org/cl/5432054
Showing
Please register or sign in to comment