go: cmd/compile: excessively slow compile for 60K lines function
The go 1.6 compiler panics on this 2.25 Mbyte source file containing a slice with 13240 elements: https://drive.google.com/file/d/0B2AF520HhpuzdzZhSVpPZGZkTUU/view
go1.6 linux/amd64 GOARCH=“amd64” GOOS=“linux”
$ go build buildme.go
# command-line-arguments
panic: runtime error: makeslice: len out of range
goroutine 1 [running]:
panic(0x804f60, 0xc86085dd70)
/usr/lib/google-golang/src/runtime/panic.go:483 +0x3ef
cmd/compile/internal/gc.newliveness(0xc82018b9e0, 0xc8200a0000, 0xc865c44000, 0x2d416, 0x2e400, 0xc866950000, 0xcee1, 0xf000, 0xc9cda4b11aac74db)
/usr/lib/google-golang/src/cmd/compile/internal/gc/plive.go:687 +0x161
cmd/compile/internal/gc.liveness(0xc82018b9e0, 0xc8200a0000, 0xc848dee900, 0xc848dee980)
/usr/lib/google-golang/src/cmd/compile/internal/gc/plive.go:1782 +0x2cf
cmd/compile/internal/gc.compile(0xc82018b9e0)
/usr/lib/google-golang/src/cmd/compile/internal/gc/pgen.go:541 +0xdf2
cmd/compile/internal/gc.funccompile(0xc82018b9e0)
/usr/lib/google-golang/src/cmd/compile/internal/gc/dcl.go:1450 +0x1c0
cmd/compile/internal/gc.Main()
/usr/lib/google-golang/src/cmd/compile/internal/gc/lex.go:472 +0x2116
cmd/compile/internal/amd64.Main()
/usr/lib/google-golang/src/cmd/compile/internal/amd64/galign.go:127 +0x58d
main.main()
/usr/lib/google-golang/src/cmd/compile/main.go:32 +0x395
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 20 (15 by maintainers)
Commits related to this issue
- cmd/compile: teach CSE that new objects are bespoke runtime.newobject never returns the same thing twice, so the resulting value will never be a common subexpression. This helps when compiling large... — committed to golang/go by josharian 8 years ago
- cmd/compile: sort partitions by dom to speed up cse We do two O(n) scans of all values in an eqclass when computing substitutions for CSE. In unfortunate cases, like those found in #15112, we can ha... — committed to golang/go by tzneal 8 years ago
- cmd/compile: speed up dom checking in cse Process a slice of equivalent values by setting replaced values to nil instead of removing them from the slice to eliminate copying. Also take advantage of ... — committed to golang/go by tzneal 8 years ago
A quick profile suggests that the only unusual performance bit here is in fact type comparison, and even that’s only ~13% of compile time. So: vast strides.