-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/internal/ld: dwarf generation slow #10763
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
Comments
(adding GOGC=off takes it down to 1.7s) |
IIRC from a couple of weeks ago, a significant amount of the allocations in the linker occur during DWARF generation. |
(Part of #10571 -- all.bash is too slow) |
Staring at pprof a bit, I think the layers of IO seem to be hurting -- a stupid hack to cache the offset in the output file (d7d3500) makes the link of libstd.so 25% faster! (4.41->3.31s best of 5 times). I think it's particularly bad for external linking, but linking godoc still improves from 1.97s to 1.79s (about 9%, again best of 5). The change makes almost no difference when -w is passed to disable dwarf. I don't know that this bug contributes especially much to the slowness of all.bash as dwarf is not produced when you run go test pkg. It does add a few seconds to the make.bash part I guess. |
Your change makes pos not flush. That's probably the real win. |
Ah yes, good point. CL coming up. |
Closing out this old bug. Much has changed in linker dwarf generation since 2015. |
I don't know if this is known or expected, but it surprised me: passing -w to 6l (to disable dwarf generation) can make it almost twice as fast (e.g. when linking the standard library into a shared library, adding -w to the command line makes the link go from ~4.5 s to ~2.2s).
The text was updated successfully, but these errors were encountered: