• Bryan C. Mills's avatar
    expvar: add benchmarks for steady-state Map Add calls · 7ffdb757
    Bryan C. Mills authored
    Add a benchmark for setting a String value, which we may
    want to treat differently from Int or Float due to the need to support
    Add methods for the latter.
    
    Update tests to use only the exported API instead of making (fragile)
    assumptions about unexported fields.
    
    The existing Map benchmarks construct a new Map for each iteration, which
    focuses the benchmark results on the initial allocation costs for the
    Map and its entries. This change adds variants of the benchmarks which
    use a long-lived map in order to measure steady-state performance for
    Map updates on existing keys.
    
    Updates #18177
    
    Change-Id: I62c920991d17d5898c592446af382cd5c04c528a
    Reviewed-on: https://go-review.googlesource.com/36959Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    7ffdb757
expvar_test.go 8.85 KB