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

rustc_metadata: Switch module children decoding to an iterator #104730

Merged
merged 3 commits into from
Nov 26, 2022

Conversation

petrochenkov
Copy link
Contributor

Previously #103578, #103524 and previous PRs simplified it as much as possible.

A couple of cleanup commits is also added.
r? @cjgillot

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 22, 2022
@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 22, 2022
@bors
Copy link
Contributor

bors commented Nov 22, 2022

⌛ Trying commit 24f2ee1 with merge 5de2b9695133b9722f45ad02503f8b6a85a29a2b...

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 22, 2022
Copy link
Contributor

@cjgillot cjgillot left a 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))
Copy link
Contributor

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?

Copy link
Contributor Author

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());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert!(!reexports.is_empty());
debug_assert!(!reexports.is_empty());

?

Copy link
Contributor Author

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.

@bors
Copy link
Contributor

bors commented Nov 22, 2022

☀️ Try build successful - checks-actions
Build commit: 5de2b9695133b9722f45ad02503f8b6a85a29a2b (5de2b9695133b9722f45ad02503f8b6a85a29a2b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (5de2b9695133b9722f45ad02503f8b6a85a29a2b): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking 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
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.6%, -0.3%] 9
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
All ❌✅ (primary) -0.5% [-0.6%, -0.3%] 9

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-3.2%, -2.1%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Nov 22, 2022
@petrochenkov
Copy link
Contributor Author

@bors r=cjgillot

@bors
Copy link
Contributor

bors commented Nov 23, 2022

📌 Commit 24f2ee1 has been approved by cjgillot

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2022
@bors
Copy link
Contributor

bors commented Nov 26, 2022

⌛ Testing commit 24f2ee1 with merge f8a2e49...

@bors
Copy link
Contributor

bors commented Nov 26, 2022

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing f8a2e49 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 26, 2022
@bors bors merged commit f8a2e49 into rust-lang:master Nov 26, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 26, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f8a2e49): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This 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.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.9% [5.9%, 5.9%] 1
Improvements ✅
(primary)
-2.3% [-2.3%, -2.3%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.3% [-2.3%, -2.3%] 1

Cycles

This benchmark run did not return any relevant results for this metric.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants