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/link: memory reductions slowed down the linker #31898

Closed
aclements opened this issue May 8, 2019 · 2 comments
Closed

cmd/link: memory reductions slowed down the linker #31898

aclements opened this issue May 8, 2019 · 2 comments
Assignees
Milestone

Comments

@aclements
Copy link
Member

@aclements aclements commented May 8, 2019

CL 173938, which switched to using mmap'd symbol name strings, made the linker 15% slower. Based on the profile, the reason appears to be completely silly: the new call to r.rd.Offset() in objReader.readSymName is remarkably expensive. The Seek call used to find the offset is roughly 20% of the profile.

@cherrymui suggested we could make bio.Reader directly use the mmap'ed backing store when we have it and simply track its own offset. We should also avoid the Offset call if we don't have the mmap'ed backing store, since we don't need it then.

Alternatively, we could continue using the underlying file, but track the offset ourselves in bio.Reader.

/cc @thanm @cherrymui

@aclements aclements added this to the Go1.13 milestone May 8, 2019
@thanm

This comment has been minimized.

Copy link
Member

@thanm thanm commented May 8, 2019

Good catch. Your analysis makes sense...

@andybons andybons added the NeedsFix label May 8, 2019
@thanm thanm self-assigned this May 8, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented May 8, 2019

Change https://golang.org/cl/176039 mentions this issue: cmd/link: fix link time regression in object file reading

@gopherbot gopherbot closed this in 0793c81 May 9, 2019
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.