• Matthew Dempsky's avatar
    cmd/compile: discard duplicate inline method bodies · f0b36269
    Matthew Dempsky authored
    If we've already imported a named type, then there's no need to
    process its associated methods except to validate that the signature
    matches the existing known method.
    
    However, the current import code still creates a new function node for
    each method, saves its inline body (if any), and adds the node to the
    global importlist. Because of this, the duplicate methods are never
    garbage collected.
    
    This CL changes the compiler to avoid amassing uncollectable garbage
    or performing any unnecessary processing.
    
    This is particularly noticeable for protobuf-heavy code. For the
    motivating Go package, this CL reduced compile max-RSS from ~12GB to
    ~3GB and compile time from ~65s to ~50s.
    
    Passes toolstash -cmp for std, cmd, and k8s.io/kubernetes/cmd/....
    
    Change-Id: Ib53ba9f2ad3212995671cf6ba220ee8a56d8d009
    Reviewed-on: https://go-review.googlesource.com/51331
    Run-TryBot: Austin Clements <austin@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarAustin Clements <austin@google.com>
    f0b36269
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...