github.com/april1989/origin-go-tools@v0.0.32/cmd/benchcmp/doc.go (about) 1 // Copyright 2014 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 7 The benchcmp command displays performance changes between benchmarks. 8 9 Benchcmp parses the output of two 'go test' benchmark runs, 10 correlates the results per benchmark, and displays the deltas. 11 12 To measure the performance impact of a change, use 'go test' 13 to run benchmarks before and after the change: 14 15 go test -run=NONE -bench=. ./... > old.txt 16 # make changes 17 go test -run=NONE -bench=. ./... > new.txt 18 19 Then feed the benchmark results to benchcmp: 20 21 benchcmp old.txt new.txt 22 23 Benchcmp will summarize and display the performance changes, 24 in a format like this: 25 26 $ benchcmp old.txt new.txt 27 benchmark old ns/op new ns/op delta 28 BenchmarkConcat 523 68.6 -86.88% 29 30 benchmark old allocs new allocs delta 31 BenchmarkConcat 3 1 -66.67% 32 33 benchmark old bytes new bytes delta 34 BenchmarkConcat 80 48 -40.00% 35 36 */ 37 package main // import "github.com/april1989/origin-go-tools/cmd/benchcmp"