• Josh Bleecher Snyder's avatar
    cmd/internal/dwarf: remove global encbuf · f9783011
    Josh Bleecher Snyder authored
    The global encbuf helped avoid allocations.
    It is incompatible with a concurrent backend.
    To avoid a performance regression while removing it,
    introduce two optimizations.
    First, re-use a buffer in dwarf.PutFunc.
    Second, avoid a buffer entirely when the int
    being encoded fits in seven bits, which is about 75%
    of the time.
    
    Passes toolstash-check.
    
    Updates #15756
    
    
    name       old alloc/op    new alloc/op    delta
    Template      40.6MB ± 0%     40.6MB ± 0%  -0.08%  (p=0.001 n=8+9)
    Unicode       29.9MB ± 0%     29.9MB ± 0%    ~     (p=0.068 n=8+10)
    GoTypes        116MB ± 0%      116MB ± 0%  +0.05%  (p=0.043 n=10+9)
    SSA            864MB ± 0%      864MB ± 0%  +0.01%  (p=0.010 n=10+9)
    Flate         25.8MB ± 0%     25.8MB ± 0%    ~     (p=0.353 n=10+10)
    GoParser      32.2MB ± 0%     32.2MB ± 0%    ~     (p=0.353 n=10+10)
    Reflect       80.2MB ± 0%     80.2MB ± 0%    ~     (p=0.165 n=10+10)
    Tar           27.0MB ± 0%     26.9MB ± 0%    ~     (p=0.143 n=10+10)
    XML           42.8MB ± 0%     42.8MB ± 0%    ~     (p=0.400 n=10+9)
    
    name       old allocs/op   new allocs/op   delta
    Template        398k ± 0%       397k ± 0%  -0.20%  (p=0.002 n=8+9)
    Unicode         320k ± 0%       321k ± 1%    ~     (p=0.122 n=8+10)
    GoTypes        1.16M ± 0%      1.17M ± 0%    ~     (p=0.053 n=10+9)
    SSA            7.65M ± 0%      7.65M ± 0%    ~     (p=0.122 n=10+8)
    Flate           240k ± 1%       240k ± 1%    ~     (p=0.243 n=10+9)
    GoParser        322k ± 1%       322k ± 1%    ~     (p=0.481 n=10+10)
    Reflect        1.00M ± 0%      1.00M ± 0%    ~     (p=0.211 n=9+10)
    Tar             256k ± 0%       255k ± 1%    ~     (p=0.052 n=10+10)
    XML             400k ± 1%       400k ± 0%    ~     (p=0.631 n=10+10)
    
    
    Change-Id: Ia39d9de09232fdbfc9c9cec14587bbf6939c9492
    Reviewed-on: https://go-review.googlesource.com/38713
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    f9783011
Name
Last commit
Last update
.github Loading commit data...
api Loading commit data...
doc Loading commit data...
lib/time Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README.md Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...