• Josh Bleecher Snyder's avatar
    cmd/6g, cmd/8g: make 2/3 word sgen more efficient · 747c8498
    Josh Bleecher Snyder authored
    When compiling the stdlib most of the calls
    to sgen are for exactly 2 or 3 words:
    85% for 6g and 70% for 8g.
    Special case them for performance.
    This optimization is not relevant to 5g and 9g.
    
    6g
    
    benchmark                old ns/op     new ns/op     delta
    BenchmarkCopyFat16       3.25          0.82          -74.77%
    BenchmarkCopyFat24       5.47          0.95          -82.63%
    
    8g
    
    benchmark               old ns/op     new ns/op     delta
    BenchmarkCopyFat8       3.84          2.42          -36.98%
    BenchmarkCopyFat12      4.94          2.15          -56.48%
    
    Change-Id: I8bc60b453f12597dfd916df2d072a7d5fc33ab85
    Reviewed-on: https://go-review.googlesource.com/2607Reviewed-by: default avatarRuss Cox <rsc@golang.org>
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    747c8498
cgen.c 33.8 KB