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