]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: reduce slice header allocation when parsing := assignments
authorRobert Griesemer <gri@golang.org>
Fri, 25 Mar 2016 22:34:55 +0000 (15:34 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 25 Mar 2016 23:09:19 +0000 (23:09 +0000)
commit135109d241da1427461fdb19656a976b3e9c7b22
tree533650cc9afb4df7a50fe96f546e98137ccf4bb8
parenta7f7a9cca749a676cee73f28e48c6f7bffa64807
cmd/compile: reduce slice header allocation when parsing := assignments

The colas function allocates 2 slice headers in each call (via Nodes.Set)
only to throw away those slice headers in the common case where both the
lhs and rhs in "lhs := rhs" have length 1.

Avoid the Nodes.Set calls in those cases. For make.bash, this eliminates
~63,000 slice header allocations.

Also: Minor cleanups in colasdefn.

Change-Id: Ib114a67c3adeb8821868bd71a5e0f5e2e19fcd4f
Reviewed-on: https://go-review.googlesource.com/21170
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/alg.go
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/parser.go