Skip to content
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/internal/ld: dwarf generation slow #10763

Closed
mwhudson opened this issue May 8, 2015 · 7 comments
Closed

cmd/internal/ld: dwarf generation slow #10763

mwhudson opened this issue May 8, 2015 · 7 comments
Milestone

Comments

@mwhudson
Copy link
Contributor

mwhudson commented May 8, 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).

@mwhudson
Copy link
Contributor Author

mwhudson commented May 8, 2015

(adding GOGC=off takes it down to 1.7s)

@josharian
Copy link
Contributor

IIRC from a couple of weeks ago, a significant amount of the allocations in the linker occur during DWARF generation.

@josharian josharian reopened this May 9, 2015
@bradfitz
Copy link
Contributor

bradfitz commented May 9, 2015

(Part of #10571 -- all.bash is too slow)

@mwhudson
Copy link
Contributor Author

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.

@bradfitz
Copy link
Contributor

Your change makes pos not flush. That's probably the real win.

@mwhudson
Copy link
Contributor Author

Ah yes, good point. CL coming up.

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jun 3, 2015
@thanm
Copy link
Contributor

thanm commented Dec 21, 2023

Closing out this old bug. Much has changed in linker dwarf generation since 2015.

@thanm thanm closed this as completed Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants