-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: xdcl_list / testdclstack slow when there are lots of decls #14781
Comments
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. |
CL https://golang.org/cl/35113 mentions this issue. |
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: