| # Copyright 2011 The Go Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style |
| # license that can be found in the LICENSE file. |
| echo 'usage: benchcmp old.txt new.txt' >&2 |
| echo 'Each input file should be gotest -bench output.' >&2 |
| echo 'Benchcmp compares the first and last for each benchmark.' >&2 |
| $1 ~ /Benchmark/ && $4 == "ns/op" { |
| print "benchcmp: no repeated benchmarks" >"/dev/stderr" |
| printf("%-*s %12s %12s %7s\n", len, "benchmark", "old ns/op", "new ns/op", "delta") |
| printf("%-*s %12d %12d %6s%%\n", len, what, old[what], new[what], |
| sprintf("%+.2f", 100*new[what]/old[what]-100)) |
| printf("\n%-*s %12s %12s %7s\n", len, "benchmark", "old MB/s", "new MB/s", "speedup") |
| printf("%-*s %12s %12s %6sx\n", len, what, |
| sprintf("%.2f", oldmb[what]), |
| sprintf("%.2f", newmb[what]), |
| sprintf("%.2f", newmb[what]/oldmb[what])) |