]> Cypherpunks repositories - gostls13.git/commit
go/printer, gofmt: avoid exponential layout algorithm
authorRobert Griesemer <gri@golang.org>
Tue, 22 Mar 2011 00:15:59 +0000 (17:15 -0700)
committerRobert Griesemer <gri@golang.org>
Tue, 22 Mar 2011 00:15:59 +0000 (17:15 -0700)
commit4a33d440b891c4aaff5769b72c3d5edcc65d42dd
tree5f02a3f92e6f4038bb4b8348ef1e76c21c86e43d
parent708013064f65f4fd0285534235657db2076dfbe2
go/printer, gofmt: avoid exponential layout algorithm

Use memoization to avoid repeated recomputation of nested
node sizes. Speeds up testdata/slow.input by several orders
of magnitude.

- added respective test case
- added timeout to test code
- deleted some unrelated unused code

Fixes #1628.

R=rsc, r
CC=golang-dev
https://golang.org/cl/4274075
src/cmd/godoc/godoc.go
src/cmd/gofix/main.go
src/cmd/gofix/main_test.go
src/cmd/gofmt/gofmt.go
src/pkg/go/printer/nodes.go
src/pkg/go/printer/printer.go
src/pkg/go/printer/printer_test.go
src/pkg/go/printer/testdata/slow.golden [new file with mode: 0644]
src/pkg/go/printer/testdata/slow.input [new file with mode: 0644]