blob: 16fd832820b1100eb91dbe6d38a27952b4d64e88 [file] [log] [blame]
Austin Clementsd8154152016-12-06 18:38:05 -05001This subrepository holds macro-benchmarks used for Go performance
2development and monitoring.
Dmitry Vyukovffc7de62014-12-12 12:44:00 +01003
Austin Clementsd8154152016-12-06 18:38:05 -05004Each benchmark is compiled into a separate binary. To build and
5install them all in the current directory, execute:
Dmitry Vyukovffc7de62014-12-12 12:44:00 +01006
Austin Clementsd8154152016-12-06 18:38:05 -05007 $ GOBIN=$PWD go get golang.org/x/benchmarks/...
Dmitry Vyukovffc7de62014-12-12 12:44:00 +01008
Austin Clementsd8154152016-12-06 18:38:05 -05009To run a benchmark, simply execute its binary.
Dmitry Vyukovffc7de62014-12-12 12:44:00 +010010
Austin Clementsd8154152016-12-06 18:38:05 -050011Each binary has a number of flags to control benchmark duration, etc.
12Run with '-help' to get the full list of flags.
Dmitry Vyukovffc7de62014-12-12 12:44:00 +010013
Austin Clementsd8154152016-12-06 18:38:05 -050014When the benchmarking finishes, the binary prints results in the
15standard Go benchmark format [1]:
Dmitry Vyukovffc7de62014-12-12 12:44:00 +010016
Austin Clementsd8154152016-12-06 18:38:05 -050017 $ garbage
18 BenchmarkGarbage/benchmem-MB=64-4 2000 6443223 ns/op 6008832 GC-bytes-from-system 230521 STW-ns/GC 15329 STW-ns/op 2780501 allocated-bytes/op 68636 allocs/op 119041368 bytes-from-system 104202240 heap-bytes-from-system 8109400 other-bytes-from-system 112427008 peak-RSS-bytes 121511936 peak-VM-bytes 720896 stack-bytes-from-system 25194000 user+sys-ns/op
Dmitry Vyukovffc7de62014-12-12 12:44:00 +010019
Austin Clementsd8154152016-12-06 18:38:05 -050020This format can be processed by tools like benchstat
21(https://golang.org/x/perf/cmd/benchstat) and benchplot
22(https://godoc.org/github.com/aclements/go-misc/benchplot).
Dmitry Vyukovffc7de62014-12-12 12:44:00 +010023
Jeff R. Allenb3b4d972017-10-27 15:59:19 +020024Required extra tools:
25 For Linux, you need "perf". On Debian/Ubuntu, you can install
26 package "perf-tools-common" to get it. Run "perf" once with no
27 arguments to check if it requires additional packages to be installed.
28
Dmitry Vyukovffc7de62014-12-12 12:44:00 +010029To submit changes to this repository, see http://golang.org/doc/contribute.html.
30
Austin Clementsd8154152016-12-06 18:38:05 -050031[1] https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md