• Josh Bleecher Snyder's avatar
    cmd/internal/gc: separate func-only Node fields · 57279ba7
    Josh Bleecher Snyder authored
    Nodes dominate gc's memory usage, but many fields are only used
    for a subset of kinds of nodes. This change pulls out fields
    used only for func-like Nodes. This reduces the size of the
    Node struct on a 64-bit machine from 504 bytes to 416 bytes (-17%).
    
    Compiling the runtime, 1.5% of nodes have a non-nil Func.
    In html/template, 2.7% of nodes have a non-nil Func.
    
    This change introduces an extra alloc and associated GC overhead
    when Func is non-nil. However, when Func is nil, as it almost
    always is, it spares the garbage collector scanning some Node fields.
    Empirically, this change appears to be roughly neutral with regard to GC.
    
    To keep the diff readable, this CL uses an embedded Func field.
    A subsequent CL will unembed the field.
    
    Passes toolstash -cmp.
    
    Change-Id: Ide86aa954b097fb8e6154f0811d3691497477004
    Reviewed-on: https://go-review.googlesource.com/7360Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    57279ba7
Name
Last commit
Last update
..
5g Loading commit data...
5l Loading commit data...
6g Loading commit data...
6l Loading commit data...
7g Loading commit data...
7l Loading commit data...
8g Loading commit data...
8l Loading commit data...
9g Loading commit data...
9l Loading commit data...
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
dist 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...
old5a Loading commit data...
old6a Loading commit data...
old8a Loading commit data...
old9a Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
yacc Loading commit data...