• Josh Bleecher Snyder's avatar
    cmd/compile: disable typPtr caching in the backend · f9fb4579
    Josh Bleecher Snyder authored
    The only new Types that the backend introduces
    are pointers to Types generated by the frontend.
    Usually, when we generate a *T,
    we cache the resulting Type in T,
    to avoid recreating it later.
    However, that caching is not concurrency safe.
    Rather than add mutexes, this CL disables that
    caching before starting the backend.
    The backend generates few enough new *Ts that the
    performance impact of this is small, particularly
    if we pre-create some commonly used *Ts.
    
    Updates #15756
    
    name       old alloc/op    new alloc/op    delta
    Template      40.3MB ± 0%     40.4MB ± 0%  +0.18%  (p=0.001 n=10+10)
    Unicode       29.8MB ± 0%     29.8MB ± 0%  +0.11%  (p=0.043 n=10+9)
    GoTypes        114MB ± 0%      115MB ± 0%  +0.33%  (p=0.000 n=9+10)
    SSA            855MB ± 0%      859MB ± 0%  +0.40%  (p=0.000 n=10+10)
    Flate         25.7MB ± 0%     25.8MB ± 0%  +0.35%  (p=0.000 n=10+10)
    GoParser      31.9MB ± 0%     32.1MB ± 0%  +0.58%  (p=0.000 n=10+10)
    Reflect       79.6MB ± 0%     79.9MB ± 0%  +0.31%  (p=0.000 n=10+10)
    Tar           26.9MB ± 0%     26.9MB ± 0%  +0.21%  (p=0.000 n=10+10)
    XML           42.5MB ± 0%     42.7MB ± 0%  +0.52%  (p=0.000 n=10+9)
    
    name       old allocs/op   new allocs/op   delta
    Template        394k ± 1%       393k ± 0%    ~     (p=0.529 n=10+10)
    Unicode         319k ± 1%       319k ± 0%    ~     (p=0.720 n=10+9)
    GoTypes        1.15M ± 0%      1.15M ± 0%  +0.14%  (p=0.035 n=10+10)
    SSA            7.53M ± 0%      7.56M ± 0%  +0.45%  (p=0.000 n=9+10)
    Flate           238k ± 0%       238k ± 1%    ~     (p=0.579 n=10+10)
    GoParser        318k ± 1%       320k ± 1%  +0.64%  (p=0.001 n=10+10)
    Reflect        1.00M ± 0%      1.00M ± 0%    ~     (p=0.393 n=10+10)
    Tar             254k ± 0%       254k ± 1%    ~     (p=0.075 n=10+10)
    XML             395k ± 0%       397k ± 0%  +0.44%  (p=0.001 n=10+9)
    
    Change-Id: I6c031ed4f39108f26969c5712b73aa2fc08cd10a
    Reviewed-on: https://go-review.googlesource.com/38417
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarMatthew Dempsky <mdempsky@google.com>
    f9fb4579
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...