]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: don't create 2 Sym's and 2 Node's for every string
authorIan Lance Taylor <iant@golang.org>
Thu, 17 Mar 2016 05:22:58 +0000 (22:22 -0700)
committerIan Lance Taylor <iant@golang.org>
Thu, 17 Mar 2016 16:15:11 +0000 (16:15 +0000)
commit65b4020403aae13676e2f84e868f35d2f72629ad
treeb3112ff6a2e864a384222952b80884d46eb261d5
parent2d56dee61bf76328b3e4289f147076eb88c5582b
cmd/compile: don't create 2 Sym's and 2 Node's for every string

For every string constant the compiler was creating 2 Sym's and 2
Node's.  It would never refer to them again, but would keep them alive
in gostringpkg.  This changes the code to just use obj.LSym's instead.

When compiling x/tools/go/types, this yields about a 15% reduction in
the number of calls to newname and a 3% reduction in the total number of
Node objects.  Unfortunately I couldn't see any change in compile time,
but reducing memory usage is desirable anyhow.

Passes toolstash -cmp.

Change-Id: I24f1cb1e6cff0a3afba4ca66f7166874917a036b
Reviewed-on: https://go-review.googlesource.com/20792
Reviewed-by: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/go.go
src/cmd/compile/internal/gc/gsubr.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/gc/reflect.go
src/cmd/compile/internal/gc/ssa.go
src/cmd/internal/obj/link.go