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

Open
mwhudson opened this issue May 8, 2015 · 6 comments

Comments

@mwhudson
Copy link
Contributor

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

This comment has been minimized.

Copy link
Contributor Author

commented May 8, 2015

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

@josharian

This comment has been minimized.

Copy link
Contributor

commented May 9, 2015

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

@josharian josharian closed this May 9, 2015

@josharian josharian reopened this May 9, 2015

@bradfitz

This comment has been minimized.

Copy link
Member

commented May 9, 2015

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

@mwhudson

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2015

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

This comment has been minimized.

Copy link
Member

commented May 10, 2015

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

@mwhudson

This comment has been minimized.

Copy link
Contributor Author

commented May 10, 2015

Ah yes, good point. CL coming up.

@ianlancetaylor ianlancetaylor added this to the Unplanned milestone Jun 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.