github.com/powerman/golang-tools@v0.1.11-0.20220410185822-5ad214d8d803/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 Deprecated: benchcmp is deprecated in favor of benchstat: golang.org/x/perf/cmd/benchstat 8 9 The benchcmp command displays performance changes between benchmarks. 10 11 Benchcmp parses the output of two 'go test' benchmark runs, 12 correlates the results per benchmark, and displays the deltas. 13 14 To measure the performance impact of a change, use 'go test' 15 to run benchmarks before and after the change: 16 17 go test -run=NONE -bench=. ./... > old.txt 18 # make changes 19 go test -run=NONE -bench=. ./... > new.txt 20 21 Then feed the benchmark results to benchcmp: 22 23 benchcmp old.txt new.txt 24 25 Benchcmp will summarize and display the performance changes, 26 in a format like this: 27 28 $ benchcmp old.txt new.txt 29 benchmark old ns/op new ns/op delta 30 BenchmarkConcat 523 68.6 -86.88% 31 32 benchmark old allocs new allocs delta 33 BenchmarkConcat 3 1 -66.67% 34 35 benchmark old bytes new bytes delta 36 BenchmarkConcat 80 48 -40.00% 37 38 */ 39 package main // import "github.com/powerman/golang-tools/cmd/benchcmp"