golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
123.98k stars 17.67k forks source link

x/perf/benchstat: Allow for hardcoded old/new name in header to be configured #48380

Open AbhiPrasad opened 3 years ago

AbhiPrasad commented 3 years ago

Feature Request

What version of Go are you using (go version)?

$ go version
go version go1.17 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/abhijeetprasad/Library/Caches/go-build"
GOENV="/Users/abhijeetprasad/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/abhijeetprasad/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/abhijeetprasad/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.17/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.17/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/abhijeetprasad/workspace/sentry-sdk-benchmark/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/_9/43498gx91ml4f25m1kt2r3jh0000gn/T/go-build1057351747=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I'm using the benchstat library to aggregate some statistics, and then displaying the results in text format. In the library, the values of old and new are hardcoded to show up when you run benchstat on two configs: https://github.com/golang/perf/blob/master/benchstat/text.go#L208.

name            old ms      new ms       delta
LatenciesMean    9.00 ± 0%   10.75 ±12%  +19.44%  (p=0.029 n=4+4)
Latencies50th    9.00 ± 0%   10.00 ± 0%  +11.11%  (p=0.029 n=4+4)
Latencies90th    10.2 ± 7%    12.2 ± 6%  +19.51%  (p=0.029 n=4+4)

What did you expect to see?

Is it possible for these values to be configured so that we display the name instead of old and new? Like the behaviour for running benchstat on 3+ configs as per: https://github.com/golang/perf/blob/master/benchstat/text.go#L210-L212.

Something like:

name  \ ms      baseline   instrumented  delta
LatenciesMean    9.00 ± 0%   10.75 ±12%  +19.44%  (p=0.029 n=4+4)
Latencies50th    9.00 ± 0%   10.00 ± 0%  +11.11%  (p=0.029 n=4+4)
Latencies90th    10.2 ± 7%    12.2 ± 6%  +19.51%  (p=0.029 n=4+4)

would be nice.

I wouldn't mind helping patch this if someone points me in the right direction. Thanks!

gopherbot commented 3 years ago

Change https://golang.org/cl/309969 mentions this issue: cmd/benchstat: new version of benchstat