• Josh Bleecher Snyder's avatar
    cmd/compile: reuse sort helpers · 0d176621
    Josh Bleecher Snyder authored
    sort.Sort's argument always escapes.
    cse generates many calls to sort.Sort.
    Set up a single escaping variable
    and re-use it across loops.
    
    name       old alloc/op     new alloc/op     delta
    Template       40.7MB ± 0%      40.2MB ± 0%  -1.24%        (p=0.000 n=15+15)
    Unicode        33.4MB ± 0%      33.3MB ± 0%  -0.09%        (p=0.000 n=15+15)
    GoTypes         121MB ± 0%       119MB ± 0%  -1.48%        (p=0.000 n=14+15)
    Compiler        474MB ± 0%       465MB ± 0%  -1.94%        (p=0.000 n=14+15)
    
    name       old allocs/op    new allocs/op    delta
    Template         405k ± 0%        394k ± 0%  -2.64%        (p=0.000 n=15+15)
    Unicode          350k ± 0%        350k ± 0%  -0.14%        (p=0.000 n=14+15)
    GoTypes         1.21M ± 0%       1.18M ± 0%  -3.07%        (p=0.000 n=15+14)
    Compiler        4.37M ± 0%       4.18M ± 0%  -4.39%        (p=0.000 n=15+15)
    
    
    Change-Id: I68cf56dafa0f3ea778826eea19908bd761556154
    Reviewed-on: https://go-review.googlesource.com/32220
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    0d176621
cse.go 9.58 KB