• Josh Bleecher Snyder's avatar
    cmd/compile: number autotmps per-func, not per-package · b87fcc6e
    Josh Bleecher Snyder authored
    Prior to this CL, autotmps were global to a package.
    They also shared numbering with static variables.
    Switch autotmp numbering to be per-function instead,
    and do implicit numbering based on len(Func.Dcl).
    This eliminates a dependency on a global variable
    from the backend without adding to the Func struct.
    While we're here, move statuniqgen closer to its
    sole remaining user.
    
    This actually improves compiler performance,
    because the autotmp_* names can now be
    reused across functions.
    
    name       old alloc/op    new alloc/op    delta
    Template      40.6MB ± 0%     40.1MB ± 0%  -1.38%  (p=0.000 n=10+10)
    Unicode       29.9MB ± 0%     29.9MB ± 0%    ~     (p=0.912 n=10+10)
    GoTypes        116MB ± 0%      114MB ± 0%  -1.53%  (p=0.000 n=10+10)
    SSA            865MB ± 0%      856MB ± 0%  -1.04%  (p=0.000 n=10+10)
    Flate         25.8MB ± 0%     25.4MB ± 0%  -1.36%  (p=0.000 n=10+10)
    GoParser      32.2MB ± 0%     32.0MB ± 0%  -0.72%  (p=0.000 n=10+10)
    Reflect       80.3MB ± 0%     79.0MB ± 0%  -1.65%  (p=0.000 n=9+10)
    Tar           27.0MB ± 0%     26.7MB ± 0%  -0.86%  (p=0.000 n=10+9)
    XML           42.8MB ± 0%     42.4MB ± 0%  -0.95%  (p=0.000 n=10+10)
    
    name       old allocs/op   new allocs/op   delta
    Template        398k ± 1%       396k ± 1%  -0.59%  (p=0.002 n=10+10)
    Unicode         321k ± 1%       321k ± 0%    ~     (p=0.912 n=10+10)
    GoTypes        1.17M ± 0%      1.16M ± 0%  -0.77%  (p=0.000 n=10+10)
    SSA            7.65M ± 0%      7.62M ± 0%  -0.40%  (p=0.000 n=10+10)
    Flate           240k ± 1%       238k ± 1%  -0.56%  (p=0.001 n=10+10)
    GoParser        323k ± 1%       320k ± 1%  -0.65%  (p=0.002 n=10+10)
    Reflect        1.01M ± 0%      1.00M ± 0%  -0.37%  (p=0.001 n=9+10)
    Tar             256k ± 1%       255k ± 0%    ~     (p=0.101 n=10+8)
    XML             400k ± 1%       398k ± 1%    ~     (p=0.063 n=10+10)
    
    
    Change-Id: I3c23ca98129137d373106990b1a3e1507bbe0cc3
    Reviewed-on: https://go-review.googlesource.com/38729
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
    b87fcc6e
go.go 7.53 KB