Go version
go version go1.26-devel_1ea7594c12 Tue Aug 12 17:15:55 2025 +0100 linux/amd64
Output of go env
in your module/workspace:
AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/daniel/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/daniel/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2048561827=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/home/daniel/src/valkey-go/go.mod'
GOMODCACHE='/home/daniel/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/daniel/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/daniel/src/godev'
GOSUMDB='sum.golang.org'
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/daniel/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/daniel/src/godev/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26-devel_1ea7594c12 Tue Aug 12 17:15:55 2025 +0100'
GOWORK=''
PKG_CONFIG='pkg-config'
What did you do?
While investigating #74974, I found that compiling github.com/valkey-io/valkey-go/internal/cmds
was very slow, even without the offending change. I took a profile and found most of the time was spent in nilcheckelim
, clearing the cached line numberings
excerpt from `-d ssa/number_lines/stats=1':
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:8:23: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 1774 MAXFILE 17506 NFILES 7580 search0
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:111:23: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 1821 MAXFILE 21575 NFILES 4060 search1
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:214:23: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 4077 MAXFILE 28287 NFILES 6712 search2
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:317:20: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 3776 MAXFILE 30555 NFILES 2269 search3
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:420:20: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 3703 MAXFILE 32161 NFILES 1607 search4
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:523:20: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 6803 MAXFILE 34554 NFILES 2384 search5
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:626:20: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 6700 MAXFILE 38035 NFILES 3474 search6
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:729:20: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 6597 MAXFILE 40677 NFILES 2636 search7
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:832:20: number_lines SUM_LINE_RANGE 100 MAXMIN_LINE_RANGE 6494 MAXFILE 42164 NFILES 1482 search8
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:935:20: number_lines SUM_LINE_RANGE 500 MAXMIN_LINE_RANGE 7399 MAXFILE 43111 NFILES 944 search9
/home/daniel/src/valkey-go/internal/cmds/gen_search_test.go:1038:20: number_lines SUM_LINE_RANGE 350 MAXMIN_LINE_RANGE 7620 MAXFILE 43536 NFILES 423 search10
These generated tests, where every expression is an inlined call, results in the line numbering jumping between files, making Func.cachedLineStarts
very large, and since we clear it on every Block during nilcheckelim, a significant time is spent here.
pprof excerpt
What did you see happen?
21.51s compile time
What did you expect to see?
Much lower compile times.
Comment From: gabyhelp
Related Issues
- cmd/compile: increased line number churn #20367 (closed)
- cmd/go: test reported as cached, but not actually cached #41593
- cmd/go: add option to output timestamps along with command tracing #22526 (closed)
- cmd/compile: compile time increased greatly in 1.25rc1 with commit ed24bb4e60 #74615 (closed)
Related Code Changes
- cmd/compile: index line number tables by source file to improve sparsity
- cmd/compile: caching result of AlgType
- cmd/compile,sync: make accessing address of zero offset struct field inline cost 0
- [dev.inline] cmd/internal/src: replace src.Pos with syntax.Pos
- cmd/compile: attempt to deflake debug_test.go
- cmd/compile: link source lines to blocks
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.)