• Josh Bleecher Snyder's avatar
    cmd/compile: add countRule rewrite rule helper · 0047353c
    Josh Bleecher Snyder authored
    noteRule is useful when you're trying to debug
    a particular rule, or get a general sense for
    how often a rule fires overall.
    
    It is less useful if you're trying to figure
    out which functions might be useful to benchmark
    to ascertain the impact of a newly added rule.
    
    Enter countRule. You use it like noteRule,
    except that you get per-function summaries.
    
    Sample output:
    
     # runtime
    (*mspan).sweep: idx1=1
    evacuate_faststr: idx1=1
    evacuate_fast32: idx1=1
    evacuate: idx1=2
    evacuate_fast64: idx1=1
    sweepone: idx1=1
    purgecachedstats: idx1=1
    mProf_Free: idx1=1
    
    This suggests that the map benchmarks
    might be good to run for this added rule.
    
    Change-Id: Id471c3231f1736165f2020f6979ff01c29677808
    Reviewed-on: https://go-review.googlesource.com/c/go/+/167088
    Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKeith Randall <khr@golang.org>
    0047353c
func.go 21.8 KB