• Russ Cox's avatar
    cmd/internal/gc: inline runtime.getg · 92c826b1
    Russ Cox authored
    This more closely restores what the old C runtime did.
    (In C, g was an 'extern register' with the same effective
    implementation as in this CL.)
    
    On a late 2012 MacBookPro10,2, best of 5 old vs best of 5 new:
    
    benchmark                          old ns/op      new ns/op      delta
    BenchmarkBinaryTree17              4981312777     4463426605     -10.40%
    BenchmarkFannkuch11                3046495712     3006819428     -1.30%
    BenchmarkFmtFprintfEmpty           89.3           79.8           -10.64%
    BenchmarkFmtFprintfString          284            262            -7.75%
    BenchmarkFmtFprintfInt             282            262            -7.09%
    BenchmarkFmtFprintfIntInt          480            448            -6.67%
    BenchmarkFmtFprintfPrefixedInt     382            358            -6.28%
    BenchmarkFmtFprintfFloat           529            486            -8.13%
    BenchmarkFmtManyArgs               1849           1773           -4.11%
    BenchmarkGobDecode                 12835963       11794385       -8.11%
    BenchmarkGobEncode                 10527170       10288422       -2.27%
    BenchmarkGzip                      436109569      438422516      +0.53%
    BenchmarkGunzip                    110121663      109843648      -0.25%
    BenchmarkHTTPClientServer          81930          85446          +4.29%
    BenchmarkJSONEncode                24638574       24280603       -1.45%
    BenchmarkJSONDecode                93022423       85753546       -7.81%
    BenchmarkMandelbrot200             4703899        4735407        +0.67%
    BenchmarkGoParse                   5319853        5086843        -4.38%
    BenchmarkRegexpMatchEasy0_32       151            151            +0.00%
    BenchmarkRegexpMatchEasy0_1K       452            453            +0.22%
    BenchmarkRegexpMatchEasy1_32       131            132            +0.76%
    BenchmarkRegexpMatchEasy1_1K       761            722            -5.12%
    BenchmarkRegexpMatchMedium_32      228            224            -1.75%
    BenchmarkRegexpMatchMedium_1K      63751          64296          +0.85%
    BenchmarkRegexpMatchHard_32        3188           3238           +1.57%
    BenchmarkRegexpMatchHard_1K        95396          96756          +1.43%
    BenchmarkRevcomp                   661587262      687107364      +3.86%
    BenchmarkTemplate                  108312598      104008540      -3.97%
    BenchmarkTimeParse                 453            459            +1.32%
    BenchmarkTimeFormat                475            441            -7.16%
    
    The garbage benchmark from the benchmarks subrepo gets 2.6% faster as well.
    
    Change-Id: I320aeda332db81012688b26ffab23f6581c59cfa
    Reviewed-on: https://go-review.googlesource.com/8460Reviewed-by: 's avatarRick Hudson <rlh@golang.org>
    Run-TryBot: Rick Hudson <rlh@golang.org>
    Reviewed-by: 's avatarAustin Clements <austin@google.com>
    92c826b1
stubs.go 8.75 KB