Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 1 | This subrepository holds macro-benchmarks used for Go performance |
| 2 | development and monitoring. |
Dmitry Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 3 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 4 | Each benchmark is compiled into a separate binary. To build and |
| 5 | install them all in the current directory, execute: |
Dmitry Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 6 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 7 | $ GOBIN=$PWD go get golang.org/x/benchmarks/... |
Dmitry Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 8 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 9 | To run a benchmark, simply execute its binary. |
Dmitry Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 10 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 11 | Each binary has a number of flags to control benchmark duration, etc. |
| 12 | Run with '-help' to get the full list of flags. |
Dmitry Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 13 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 14 | When the benchmarking finishes, the binary prints results in the |
| 15 | standard Go benchmark format [1]: |
Dmitry Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 16 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 17 | $ 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 Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 19 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 20 | This 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 Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 23 | |
Jeff R. Allen | b3b4d97 | 2017-10-27 15:59:19 +0200 | [diff] [blame] | 24 | Required 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 Vyukov | ffc7de6 | 2014-12-12 12:44:00 +0100 | [diff] [blame] | 29 | To submit changes to this repository, see http://golang.org/doc/contribute.html. |
| 30 | |
Austin Clements | d815415 | 2016-12-06 18:38:05 -0500 | [diff] [blame] | 31 | [1] https://github.com/golang/proposal/blob/master/design/14313-benchmark-format.md |