• Josh Bleecher Snyder's avatar
    cmd/compile: shrink liveness maps · 1e27e480
    Josh Bleecher Snyder authored
    The GC maps don't care about trailing non-pointers in args.
    Work harder to eliminate them.
    
    This should provide a slight speedup to everything that reads these
    maps, mainly GC and stack copying.
    
    The non-ptr-y runtime benchmarks happen to go from having a non-empty
    args map to an empty args map, so they have a significant speedup.
    
    name                old time/op  new time/op  delta
    StackCopyPtr-8      80.2ms ± 4%  79.7ms ± 2%  -0.63%  (p=0.001 n=94+91)
    StackCopy-8         63.3ms ± 3%  59.2ms ± 3%  -6.45%  (p=0.000 n=98+97)
    StackCopyNoCache-8   107ms ± 3%    98ms ± 3%  -8.00%  (p=0.000 n=95+88)
    
    It also shrinks object files a tiny bit:
    
    name        old object-bytes  new object-bytes  delta
    Template          476kB ± 0%        476kB ± 0%  -0.03%  (p=0.008 n=5+5)
    Unicode           218kB ± 0%        218kB ± 0%  -0.09%  (p=0.008 n=5+5)
    GoTypes          1.58MB ± 0%       1.58MB ± 0%  -0.03%  (p=0.008 n=5+5)
    Compiler         6.25MB ± 0%       6.24MB ± 0%  -0.06%  (p=0.008 n=5+5)
    SSA              15.9MB ± 0%       15.9MB ± 0%  -0.06%  (p=0.008 n=5+5)
    Flate             304kB ± 0%        303kB ± 0%  -0.29%  (p=0.008 n=5+5)
    GoParser          370kB ± 0%        370kB ± 0%  +0.02%  (p=0.008 n=5+5)
    Reflect          1.27MB ± 0%       1.27MB ± 0%  -0.07%  (p=0.008 n=5+5)
    Tar               421kB ± 0%        421kB ± 0%  -0.05%  (p=0.008 n=5+5)
    XML               518kB ± 0%        517kB ± 0%  -0.06%  (p=0.008 n=5+5)
    [Geo mean]        934kB             933kB       -0.07%
    
    Note that some object files do grow;
    this can happen because some maps that were
    duplicates of each others must be stored separately.
    
    Change-Id: Ie076891bd8e9d269ff2ff5435d5d25c721e0e31d
    Reviewed-on: https://go-review.googlesource.com/104175
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarAustin Clements <austin@google.com>
    1e27e480
plive.go 35.8 KB