internal/telemetry: change tag to use type specific storage

Because packing values into interface{} causes allocations
this gives us a major improvement on allocation count, but
tag is bigger so a significant loss on bytes allocated.
It is a minor performance win overall, especially in the
null exporter case when it really matters the most.

name                old time/op    new time/op    delta
/Baseline-8            147ns ± 3%     146ns ± 3%     ~     (p=0.349 n=5+5)
/StdLog-8             6.83µs ± 1%    6.78µs ± 2%     ~     (p=0.548 n=5+5)
/LogNoExporter-8      1.15µs ± 1%    1.05µs ± 1%   -8.63%  (p=0.008 n=5+5)
/TraceNoExporter-8    1.01µs ± 4%    0.99µs ± 1%     ~     (p=0.087 n=5+5)
/StatsNoExporter-8    1.89µs ± 0%    1.95µs ± 3%   +3.27%  (p=0.016 n=4+5)
/Log-8                23.7µs ± 1%    24.4µs ± 6%   +3.14%  (p=0.032 n=5+5)
/Trace-8              42.2µs ± 1%    42.2µs ± 1%     ~     (p=0.841 n=5+5)
/Stats-8              7.37µs ± 3%    7.10µs ± 1%   -3.74%  (p=0.008 n=5+5)

name                old alloc/op   new alloc/op   delta
/Baseline-8            0.00B          0.00B          ~     (all equal)
/StdLog-8               552B ± 0%      552B ± 0%     ~     (all equal)
/LogNoExporter-8        680B ± 0%     1024B ± 0%  +50.59%  (p=0.008 n=5+5)
/TraceNoExporter-8      512B ± 0%      512B ± 0%     ~     (all equal)
/StatsNoExporter-8    1.26kB ± 0%    2.05kB ± 0%  +62.03%  (p=0.008 n=5+5)
/Log-8                5.20kB ± 0%    6.06kB ± 0%  +16.46%  (p=0.008 n=5+5)
/Trace-8              11.8kB ± 0%    11.8kB ± 0%     ~     (p=0.167 n=5+5)
/Stats-8              2.29kB ± 0%    3.07kB ± 0%  +34.27%  (p=0.008 n=5+5)

name                old allocs/op  new allocs/op  delta
/Baseline-8             0.00           0.00          ~     (all equal)
/StdLog-8               30.0 ± 0%      30.0 ± 0%     ~     (all equal)
/LogNoExporter-8        30.0 ± 0%      16.0 ± 0%  -46.67%  (p=0.008 n=5+5)
/TraceNoExporter-8      16.0 ± 0%      16.0 ± 0%     ~     (all equal)
/StatsNoExporter-8      62.0 ± 0%      32.0 ± 0%  -48.39%  (p=0.008 n=5+5)
/Log-8                   172 ± 0%       158 ± 0%   -8.14%  (p=0.008 n=5+5)
/Trace-8                 336 ± 0%       336 ± 0%     ~     (all equal)
/Stats-8                94.0 ± 0%      64.0 ± 0%  -31.91%  (p=0.008 n=5+5)

Change-Id: I81d2443c9a32d25a5b60fffa60759caa33566da2
Reviewed-on: https://go-review.googlesource.com/c/tools/+/225381
Run-TryBot: Ian Cottrell <iancottrell@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Robert Findley <rfindley@google.com>
2 files changed
tree: eda70c53e254f46f9b3687b43b3635357d65f9cf
  1. benchmark/
  2. blog/
  3. cmd/
  4. container/
  5. cover/
  6. go/
  7. godoc/
  8. gopls/
  9. imports/
  10. internal/
  11. playground/
  12. present/
  13. refactor/
  14. txtar/
  15. .gitattributes
  16. .gitignore
  17. AUTHORS
  18. codereview.cfg
  19. CONTRIBUTING.md
  20. CONTRIBUTORS
  21. go.mod
  22. go.sum
  23. LICENSE
  24. PATENTS
  25. README.md
README.md

Go Tools

This subrepository holds the source for various packages and tools that support the Go programming language.

Some of the tools, godoc and vet for example, are included in binary Go distributions.

Others, including the Go guru and the test coverage tool, can be fetched with go get.

Packages include a type-checker for Go and an implementation of the Static Single Assignment form (SSA) representation for Go programs.

Download/Install

The easiest way to install is to run go get -u golang.org/x/tools/.... You can also manually git clone the repository to $GOPATH/src/golang.org/x/tools.

Report Issues / Send Patches

This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html.

The main issue tracker for the tools repository is located at https://github.com/golang/go/issues. Prefix your issue with “x/tools/(your subdir):” in the subject line, so it is easy to find.