-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc_metadata: Switch module children decoding to an iterator #104730
Conversation
This is more a cleanup than optimization
to unify proc-macro and non-proc-macro cases in particular.
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 24f2ee1 with merge 5de2b9695133b9722f45ad02503f8b6a85a29a2b... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 questions, and r=me
@@ -204,7 +204,9 @@ impl<'a> Resolver<'a> { | |||
} | |||
|
|||
pub(crate) fn build_reduced_graph_external(&mut self, module: Module<'a>) { | |||
for child in self.cstore().module_children_untracked(module.def_id(), self.session) { | |||
for child in | |||
Vec::from_iter(self.cstore().module_children_untracked(module.def_id(), self.session)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the from_iter
first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to borrow checker, self
is mutably borrowed inside the loop.
@@ -1305,6 +1298,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { | |||
} | |||
} | |||
})); | |||
|
|||
if let Some(reexports) = tcx.module_reexports(local_def_id) { | |||
assert!(!reexports.is_empty()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assert!(!reexports.is_empty()); | |
debug_assert!(!reexports.is_empty()); |
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert is very cheap (both in absolute value, and relatively to everything else happening here), so I think we can always enable it.
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (5de2b9695133b9722f45ad02503f8b6a85a29a2b): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. @bors rollup=never Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
@bors r=cjgillot |
☀️ Test successful - checks-actions |
Finished benchmarking commit (f8a2e49): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. |
Previously #103578, #103524 and previous PRs simplified it as much as possible.
A couple of cleanup commits is also added.
r? @cjgillot