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: Optimize and document module children decoding #92086

Merged
merged 3 commits into from
Jan 9, 2022

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Dec 18, 2021

The first commit limits the item in the item_children/each_child_of_item query to modules (in name resolution sense) and adds a corresponding assertion.
The associated_item_def_ids query collecting children of traits and impls specifically now uses a simplified implementation not decoding unnecessary data instead of each_child_of_item, this gives a nice performance improvement.

The second commit does some renaming that clarifies the terminology used for all items in a module vs use items only.

@rustbot rustbot added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Dec 18, 2021
@rust-highfive
Copy link
Collaborator

Some changes occurred in src/tools/clippy.

cc @rust-lang/clippy

Some changes occurred in clean/types.rs.

cc @camelid

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 18, 2021
@petrochenkov
Copy link
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

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

bors commented Dec 18, 2021

⌛ Trying commit 62815a1f8ff0f1e06dd3f25b4aed88d32c2786f9 with merge 98c9bec5b9e4114d772623fd397e74d74b25da83...

@petrochenkov petrochenkov removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 18, 2021
@bors
Copy link
Contributor

bors commented Dec 18, 2021

☀️ Try build successful - checks-actions
Build commit: 98c9bec5b9e4114d772623fd397e74d74b25da83 (98c9bec5b9e4114d772623fd397e74d74b25da83)

@rust-timer
Copy link
Collaborator

Queued 98c9bec5b9e4114d772623fd397e74d74b25da83 with parent d3848cb, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (98c9bec5b9e4114d772623fd397e74d74b25da83): comparison url.

Summary: This change led to very large relevant improvements 🎉 in compiler performance.

  • Very large improvement in instruction counts (up to -14.5% on incr-unchanged builds of issue-88862)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

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 led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@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 Dec 19, 2021
@petrochenkov petrochenkov changed the title [WIP] rustc_metadata: Optimize and document module children decoding rustc_metadata: Optimize and document module children decoding Dec 21, 2021
@petrochenkov
Copy link
Contributor Author

This should be ready now.

@petrochenkov
Copy link
Contributor Author

This is kind of a pre-requisite for #91795, so it's better to land it sooner.
r? rust-lang/compiler

@bors

This comment has been minimized.

Copy link
Member

@jackh726 jackh726 left a comment

Choose a reason for hiding this comment

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

I think just one comment here.

For the most part looks okay to me, with the caveat that most of this code I've never really read before.

If it's not too much trouble, can you split the two major renames here to a separate commit? (item_children -> module_children and each_child_of_item -> get_module_children). That would make me more comfortable reviewing this,

compiler/rustc_metadata/src/rmeta/decoder.rs Outdated Show resolved Hide resolved

/// Iterates over all named children of the given module,
/// including both proper items and reexports.
/// Module here is understood in name resolution sense - it can be a `mod` item,
Copy link
Member

Choose a reason for hiding this comment

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

The overloading of the term Module is definitely confusing....

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 22, 2021
@petrochenkov petrochenkov removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 23, 2021
@bors bors added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jan 8, 2022
…n(_untracked)`

And `each_child_of_item` to `for_each_module_child`
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
@petrochenkov
Copy link
Contributor Author

@bors r=jackh726

@bors
Copy link
Contributor

bors commented Jan 9, 2022

📌 Commit 4b03fd9 has been approved by jackh726

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 9, 2022
@bors
Copy link
Contributor

bors commented Jan 9, 2022

⌛ Testing commit 4b03fd9 with merge d4135a2a8b08d4b9afb1ae4980ed1b8914b6af14...

@bors
Copy link
Contributor

bors commented Jan 9, 2022

💥 Test timed out

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

cjgillot commented Jan 9, 2022

@bors retry

@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 Jan 9, 2022
@bors
Copy link
Contributor

bors commented Jan 9, 2022

⌛ Testing commit 4b03fd9 with merge e19ca1d...

@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Contributor

bors commented Jan 9, 2022

☀️ Test successful - checks-actions
Approved by: jackh726
Pushing e19ca1d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 9, 2022
@bors bors merged commit e19ca1d into rust-lang:master Jan 9, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 9, 2022
@rust-highfive
Copy link
Collaborator

📣 Toolstate changed by #92086!

Tested on commit e19ca1d.
Direct link to PR: #92086

💔 miri on windows: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
💔 miri on linux: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).

rust-highfive added a commit to rust-lang-nursery/rust-toolstate that referenced this pull request Jan 9, 2022
Tested on commit rust-lang/rust@e19ca1d.
Direct link to PR: <rust-lang/rust#92086>

💔 miri on windows: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
💔 miri on linux: test-pass → build-fail (cc @eddyb @oli-obk @RalfJung).
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (e19ca1d): comparison url.

Summary: This change led to very large relevant improvements 🎉 in compiler performance.

  • Very large improvement in instruction counts (up to -14.9% on incr-unchanged builds of issue-88862)

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

dario23 added a commit to dario23/rust-semverver that referenced this pull request May 4, 2022
For us this mostly means changing `hir::exports::Export` to
`metadata::ModChild` and `tcx.item_children` to `tcx.module_children`.
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants