errors/fmt: added benchmarks for stack trace

Removing the intermediate errorf improves
performance by 12-18%.

Old: with intermediate errorf, New: errorf removed:

name                                  old time/op  new time/op  delta
Errorf/no_format/ExpWithTrace-8        626ns ± 6%   514ns ± 8%  -17.92%  (p=0.029 n=4+4)
Errorf/no_format/ExpNoTrace-8          116ns ± 1%   112ns ± 1%   -3.03%  (p=0.029 n=4+4)
Errorf/no_format/Core-8                226ns ± 1%   227ns ± 1%     ~     (p=0.714 n=4+4)
Errorf/with_format/ExpWithTrace-8      668ns ± 1%   564ns ± 1%  -15.59%  (p=0.029 n=4+4)
Errorf/with_format/ExpNoTrace-8        170ns ± 1%   166ns ± 2%     ~     (p=0.057 n=4+4)
Errorf/with_format/Core-8              274ns ± 1%   272ns ± 1%     ~     (p=0.343 n=4+4)
Errorf/method:_mytype/ExpWithTrace-8   938ns ± 2%   820ns ± 1%  -12.56%  (p=0.029 n=4+4)
Errorf/method:_mytype/ExpNoTrace-8     404ns ± 2%   390ns ± 2%   -3.47%  (p=0.029 n=4+4)
Errorf/method:_mytype/Core-8           358ns ± 1%   358ns ± 1%     ~     (p=0.657 n=4+4)
Errorf/method:_number/ExpWithTrace-8  1.03µs ± 1%  0.90µs ± 1%  -12.70%  (p=0.029 n=4+4)
Errorf/method:_number/ExpNoTrace-8     496ns ± 2%   480ns ± 0%   -3.12%  (p=0.029 n=4+4)
Errorf/method:_number/Core-8           652ns ± 2%   659ns ± 2%     ~     (p=0.343 n=4+4)

Change-Id: Ied17d4265342507f7c9c39977f2fddd416c6e503
Reviewed-on: https://go-review.googlesource.com/c/146197
Run-TryBot: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
4 files changed
tree: a2d101f64d9833d839f9c365861306c82d3c5bf4
  1. apidiff/
  2. cmd/
  3. ebnf/
  4. ebnflint/
  5. errors/
  6. fsnotify/
  7. inotify/
  8. io/
  9. mmap/
  10. old/
  11. rand/
  12. shiny/
  13. shootout/
  14. utf8string/
  15. winfsnotify/
  16. .gitattributes
  17. .gitignore
  18. AUTHORS
  19. codereview.cfg
  20. CONTRIBUTING.md
  21. CONTRIBUTORS
  22. LICENSE
  23. PATENTS
  24. README.md
README.md

exp

This subrepository holds experimental and deprecated (in the old directory) packages.

The idea for this subrepository originated as the pkg/exp directory of the main repository, but its presence there made it unavailable to users of the binary downloads of the Go installation. The subrepository has therefore been created to make it possible to go get these packages.

Warning: Packages here are experimental and unreliable. Some may one day be promoted to the main repository or other subrepository, or they may be modified arbitrarily or even disappear altogether.

In short, code in this subrepository is not subject to the Go 1 compatibility promise. (No subrepo is, but the promise is even more likely to be violated by go.exp than the others.)

Caveat emptor.