]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: reduce slice growth in fuseBlockPlain
authorJosh Bleecher Snyder <josharian@gmail.com>
Wed, 11 Jan 2017 21:58:20 +0000 (13:58 -0800)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 2 Feb 2017 18:50:54 +0000 (18:50 +0000)
commit16e430e1ef8b9c9259bb4f07a0787de4310b3041
tree44e5745e2de22acd9e97460565f56630595a2a9f
parent01c8719f8b6cc689c6b446ed01ce570bce7d6287
cmd/compile: reduce slice growth in fuseBlockPlain

Instead of always appending to c.Values,
choose whichever slice is larger;
b.Values will be set to nil anyway.

Appending once instead of in a loop also
limits slice growth to once per function call
and is more efficient.

Reduces max rss for the program in #18602 by 6.5%,
and eliminates fuseBlockPlain from the alloc_space
pprof output. fuseBlockPlain previously accounted
for 16.74% of allocated memory.

Updates #18602.

Change-Id: I417b03722d011a59a679157da43dc91f4425210e
Reviewed-on: https://go-review.googlesource.com/35114
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/fuse.go