Skip to content

Box DiagnosticMetadata field in LateResolutionVisitor #97954

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

Closed
estebank opened this issue Jun 10, 2022 · 3 comments · Fixed by #98120
Closed

Box DiagnosticMetadata field in LateResolutionVisitor #97954

estebank opened this issue Jun 10, 2022 · 3 comments · Fixed by #98120
Assignees
Labels
A-technical-debt Area: Internal cleanup work E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@estebank
Copy link
Contributor

estebank commented Jun 10, 2022

We should experiment with making the rustc_resolve::late::DiagnosticMetadata field in rustc_resolve::late::LateResolutionVisitor boxed and run perf to see if that improves compilation times.

@estebank estebank added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-technical-debt Area: Internal cleanup work labels Jun 10, 2022
@eggyal
Copy link
Contributor

eggyal commented Jun 10, 2022

@rustbot claim

@eggyal
Copy link
Contributor

eggyal commented Jun 10, 2022

Actually, I'm not sure I understand how this (alone) could yield any improvement; is there something more to the proposed changes? As it stands, purely boxing the diagnostic_metadata field will surely only add heap allocation cost?

@eggyal eggyal removed their assignment Jun 14, 2022
@TaKO8Ki TaKO8Ki self-assigned this Jun 15, 2022
@estebank
Copy link
Contributor Author

@eggyal Thanks for looking into this!

As it stands, purely boxing the diagnostic_metadata field will surely only add heap allocation cost?

It depends entirely on the access patterns. Some of the diagnostic metadata substructs we have elsewhere in the compiler are accessed very rarely, while their parent struct is moved/copied/cloned often, so moving those into the heap provides improvements due to better caching/inlining. I had a hunch that this particular case might not be too impactful, but it was worth testing (and there are a handful of cases where there seems to be benefit!).

@bors bors closed this as completed in 96c2df8 Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-technical-debt Area: Internal cleanup work E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants