Open
Description
Go version
go version go1.24.0 windows/amd64
Output of go env
in your module/workspace:
set AR=ar
set CC=gcc
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_ENABLED=0
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set CXX=g++
set GCCGO=gccgo
set GO111MODULE=on
set GOAMD64=v1
set GOARCH=amd64
set GOAUTH=netrc
set GOBIN=
set GOCACHE=C:\Users\HaoZi\AppData\Local\go-build
set GOCACHEPROG=
set GODEBUG=
set GOENV=C:\Users\HaoZi\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFIPS140=off
set GOFLAGS=
set GOGCCFLAGS=-m64 -fno-caret-diagnostics -Qunused-arguments -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\HaoZi\AppData\Local\Temp\go-build849545782=/tmp/go-build -gno-record-gcc-switches
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMOD=C:\Users\HaoZi\Desktop\panel\backend\go.mod
set GOMODCACHE=C:\Users\HaoZi\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\HaoZi\go
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:/Program Files/Go
set GOSUMDB=sum.golang.org
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\HaoZi\AppData\Roaming\go\telemetry
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.24.0
set GOWORK=
set PKG_CONFIG=pkg-config
What did you do?
I wrote a very simple hello world program.
package main
func main() {
println("Hello, World!")
}
Then I compiled it using the go build -p=1 -debug-actiongraph="compile.json"
and go build -debug-actiongraph="compile2.json"
commands respectively, and used the actiongraph tool to analyze the results.
What did you see happen?
The results are as follows:
PS C:\Users\HaoZi\Desktop\test> actiongraph top -f compile.json
0.023s 25.59% build runtime
0.015s 41.81% build internal/goarch
0.014s 57.68% build test
0.014s 72.79% build internal/abi
0.003s 76.27% build internal/goexperiment
0.002s 78.68% build internal/chacha8rand
0.002s 81.07% build internal/runtime/maps
0.002s 83.37% build internal/bytealg
0.002s 85.10% build internal/runtime/atomic
0.002s 86.82% link test
0.002s 88.54% build internal/runtime/sys
0.001s 89.70% build internal/race
0.001s 90.86% build internal/cpu
0.001s 92.00% build internal/runtime/exithook
0.001s 93.15% build internal/byteorder
0.001s 94.29% build internal/stringslite
0.001s 95.44% build internal/goos
0.001s 96.57% build internal/msan
0.001s 97.15% build internal/asan
0.001s 97.72% link-install test
PS C:\Users\HaoZi\Desktop\test> actiongraph top -f compile2.json
40.348s 99.17% build internal/godebugs
0.032s 99.25% build internal/runtime/atomic
0.032s 99.33% build internal/cpu
0.027s 99.39% build internal/goexperiment
0.024s 99.45% build runtime
0.023s 99.51% build internal/byteorder
0.022s 99.56% build internal/profilerecord
0.022s 99.62% build internal/msan
0.022s 99.67% build internal/asan
0.021s 99.72% build internal/goarch
0.021s 99.77% build internal/goos
0.020s 99.82% build internal/coverage/rtcov
0.017s 99.86% build internal/abi
0.015s 99.90% build internal/runtime/sys
0.013s 99.93% build test
0.013s 99.96% build internal/chacha8rand
0.005s 99.97% build internal/bytealg
0.004s 99.98% build internal/runtime/math
0.002s 99.99% build internal/runtime/maps
0.002s 99.99% build internal/runtime/exithook
Obviously, the normal speed is achieved after using the -p=1
parameter, while it takes 40s without using it.
My PC uses an AMD 6800H processor and a Samsung 980 PRO NVMe SSD. I think it's unlikely that it's a hardware problem that causes such a big difference.
What did you expect to see?
Compilation speed is normal when -p=1
parameter is not used.