]> Cypherpunks repositories - gostls13.git/commit
expvar: add benchmarks for steady-state Map Add calls
authorBryan C. Mills <bcmills@google.com>
Tue, 14 Feb 2017 06:00:49 +0000 (01:00 -0500)
committerBryan Mills <bcmills@google.com>
Tue, 14 Feb 2017 22:11:35 +0000 (22:11 +0000)
commit7ffdb757758c086556e5eba277202d9d8940c2bd
tree6065be1966692c5c287a1f21a9eb0626e6652910
parentd2fea0447fbfb26fa675baa8c628da48a23e52b4
expvar: add benchmarks for steady-state Map Add calls

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/36959
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/expvar/expvar_test.go