Skip to content

cmd/compile: xdcl_list / testdclstack slow when there are lots of decls #14781

@josharian

Description

@josharian
$ go get github.com/davecheney/genpkg
$ genpkg -n 50000 > x.go
$ go tool compile -cpuprofile=cpu.prof -d=ssa/check/off x.go  # slow!
$ go tool pprof -pdf `go tool -n compile` cpu.prof > cpu.pdf

testdclstack shows up as ~20% of the cpu time, with xdcl_list one frame up.

I quick look suggests that there may be an O(n^2) interaction between xdcl_list and testdclstack--it looks like xdcl_list adds decls one at a time and calls testdclstack for the entire stack each time. (Could testdclstack be called after the loop instead?)

I think that @mdempsky or @griesemer may be looking into this (and I am not); just filing an issue so we don't forget about it.

cc @davecheney -- thanks for the test case :)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions