• Robert Griesemer's avatar
    go/printer, gofmt: 20 to 30% faster gofmt · a0e54aaf
    Robert Griesemer authored
    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
    a0e54aaf
nodes.go 40.1 KB