• Dave Cheney's avatar
    cmd/compile/internal/gc: avoid append when building Type fields · 1a9373bc
    Dave Cheney authored
    As a followup to CL 21296, avoid append operations when constructing the
    fields of a Type if the length is known beforehand
    
    This also includes some small scoping driveby cleanups, and a change to
    tointerface0 to avoid iterating over the field list twice.
    
    compilebench shows a very small reduction in allocations.
    
     name      old time/op    new time/op    delta
    Template     364ms ± 5%     363ms ± 4%    ~     (p=0.945 n=20+19)
    Unicode      182ms ±11%     185ms ±12%    ~     (p=0.445 n=20+20)
    GoTypes      1.14s ± 2%     1.14s ± 3%    ~     (p=0.221 n=20+20)
    Compiler     5.85s ± 2%     5.84s ± 2%    ~     (p=0.369 n=20+20)
    
    name      old alloc/op   new alloc/op   delta
    Template    56.7MB ± 0%    56.7MB ± 0%  -0.04%  (p=0.000 n=20+20)
    Unicode     38.3MB ± 0%    38.3MB ± 0%    ~     (p=0.728 n=20+19)
    GoTypes      180MB ± 0%     180MB ± 0%  -0.02%  (p=0.000 n=20+20)
    Compiler     812MB ± 0%     812MB ± 0%  -0.02%  (p=0.000 n=19+20)
    
    name      old allocs/op  new allocs/op  delta
    Template      482k ± 0%      480k ± 0%  -0.34%  (p=0.000 n=20+20)
    Unicode       377k ± 0%      377k ± 0%  -0.04%  (p=0.010 n=20+20)
    GoTypes      1.36M ± 0%     1.35M ± 0%  -0.24%  (p=0.000 n=20+20)
    Compiler     5.47M ± 0%     5.46M ± 0%  -0.11%  (p=0.000 n=20+18)
    
    Change-Id: Ibb4c40229fa3816acd8de98ba41d1571a2aabacf
    Reviewed-on: https://go-review.googlesource.com/21352Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Run-TryBot: Dave Cheney <dave@cheney.net>
    1a9373bc
Name
Last commit
Last update
..
builtin Loading commit data...
testdata Loading commit data...
alg.go Loading commit data...
align.go Loading commit data...
bexport.go Loading commit data...
bimport.go Loading commit data...
builtin.go Loading commit data...
builtin_test.go Loading commit data...
bv.go Loading commit data...
cgen.go Loading commit data...
closure.go Loading commit data...
const.go Loading commit data...
cplx.go Loading commit data...
dcl.go Loading commit data...
esc.go Loading commit data...
export.go Loading commit data...
float_test.go Loading commit data...
fmt.go Loading commit data...
gen.go Loading commit data...
global_test.go Loading commit data...
go.go Loading commit data...
gsubr.go Loading commit data...
init.go Loading commit data...
inl.go Loading commit data...
lex.go Loading commit data...
magic.go Loading commit data...
main.go Loading commit data...
mkbuiltin.go Loading commit data...
mpfloat.go Loading commit data...
mpint.go Loading commit data...
obj.go Loading commit data...
opnames.go Loading commit data...
order.go Loading commit data...
parser.go Loading commit data...
pgen.go Loading commit data...
pgen_test.go Loading commit data...
plive.go Loading commit data...
popt.go Loading commit data...
racewalk.go Loading commit data...
range.go Loading commit data...
reflect.go Loading commit data...
reflect_test.go Loading commit data...
reg.go Loading commit data...
select.go Loading commit data...
sinit.go Loading commit data...
sizeof_test.go Loading commit data...
ssa.go Loading commit data...
ssa_test.go Loading commit data...
subr.go Loading commit data...
swt.go Loading commit data...
swt_test.go Loading commit data...
syntax.go Loading commit data...
type.go Loading commit data...
typecheck.go Loading commit data...
universe.go Loading commit data...
unsafe.go Loading commit data...
util.go Loading commit data...
walk.go Loading commit data...