Closed
Description
Go version
go version go1.24.1 darwin/arm64
Output of go env
in your module/workspace:
AR='ar'
CC='cc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='c++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN='/Users/onsi/bin'
GOCACHE='/Users/onsi/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/onsi/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/rb/2gkngfn90ts_trzmrly1v9q00000gn/T/go-build785404135=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/onsi/code/browser/go.mod'
GOMODCACHE='/Users/onsi/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/onsi/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/opt/homebrew/Cellar/go/1.24.1/libexec'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/onsi/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/opt/homebrew/Cellar/go/1.24.1/libexec/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.24.1'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
I'm the author/maintainer of Ginkgo and have long struggled to get ginkgo's compile and launch performance to match go tests. For reasons related to ginkgo's architecture it's simpler for me to run go test -c
to produce a binary file then run that file.
But I'm seeing that go test -c
can be substantially slower than go test
and I'd like to understand if this is a bug or if there's something I can do in how I invoke the go toolchain to improve performance.
What did you see happen?
As a simple reproducer you can clone https://github.com/gost-dom/browser (not my repo - but it exemplifies the problem well) and checkout sha 390898e
.
What did you expect to see?
From the root directory of the repo I find:
code/browser » time go test -count=1
...
go test -count=1 1.21s user 1.20s system 261% cpu 0.922 total
vs
code/browser » time go test -c
go test -c 2.70s user 1.34s system 171% cpu 2.351 total
Am I holding it wrong?