You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ 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.
testdclstack is a consistency check only - fine to disable (and only run in a special debug mode in the compiler)
In the long run we should replace this sequential list and use a proper block structure. I've started working on this yesterday but hit some roadblocks.
I'm curious if the problem is that declare is adding PFUNC declarations (i.e., global function declarations) to dclstack, rather than adding them to externdecl like it already does for PEXTERN declarations (i.e., global variable, const, type declarations). There shouldn't be any need for us to track package scoped symbols in dclstack.
This reduces compilation time for the program
in #18602 from 7 hours to 30 min.
Updates #14781
Updates #18602
Change-Id: I3c4af878a08920e6373d3b3b0c4453ee002e32eb
Reviewed-on: https://go-review.googlesource.com/35113
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
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 :)
The text was updated successfully, but these errors were encountered: