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: use a table for super_predicates, fn_sig, impl_trait_ref. #65583

Merged
merged 3 commits into from
Oct 24, 2019

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Oct 19, 2019

This is an attempt at a part of #65407, i.e. moving parts of cross-crate "metadata" into tables that match queries more closely.

Three new tables should be enough to see some perf/metadata size changes.
(need to do something similar to #59953 (comment))

There are other bits of data that could be made into tables, but they can be more compact so the impact would likely be not as bad, and they're also more work to set up.

@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 Oct 19, 2019
@eddyb
Copy link
Member Author

eddyb commented Oct 19, 2019

@bors try

@bors
Copy link
Contributor

bors commented Oct 19, 2019

⌛ Trying commit 2c91ec26a69d472036090c56c99ad5144d213153 with merge 238668d24087abeafc989aadc78ee7c41a3c59d6...

@bors
Copy link
Contributor

bors commented Oct 19, 2019

☀️ Try build successful - checks-azure
Build commit: 238668d24087abeafc989aadc78ee7c41a3c59d6 (238668d24087abeafc989aadc78ee7c41a3c59d6)

@eddyb
Copy link
Member Author

eddyb commented Oct 19, 2019

@rust-timer build 238668d24087abeafc989aadc78ee7c41a3c59d6

@rust-timer
Copy link
Collaborator

Queued 238668d24087abeafc989aadc78ee7c41a3c59d6 with parent 518deda, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking try commit 238668d24087abeafc989aadc78ee7c41a3c59d6, comparison URL.

@eddyb
Copy link
Member Author

eddyb commented Oct 19, 2019

This is smaller increase than #59953 (comment), which is a good sign:

Before (518deda)
rust-std.tar.xz
After (238668d24087abeafc989aadc78ee7c41a3c59d6)
rust-std.tar.xz
Increase
libcore.rlib 25.85MB 26.12MB 1.0%
libstd.rlib 10.12MB 10.23MB 1.1%
Total 178.36MB 178.60MB 0.1%

(Note that the total is compressed with XZ, but also includes librustc*, soon to be in a separate rustc-dev component)

@eddyb eddyb force-pushed the more-query-like-cross-crate-tables branch from 2c91ec2 to 9af9827 Compare October 20, 2019 14:24
@eddyb
Copy link
Member Author

eddyb commented Oct 20, 2019

r? @michaelwoerister

Copy link
Member

@michaelwoerister michaelwoerister left a comment

Choose a reason for hiding this comment

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

Looks like an improvement! r=me with the nits addressed.

@@ -1321,10 +1327,11 @@ impl EncodeContext<'tcx> {
fn encode_info_for_closure(&mut self, def_id: DefId) {
debug!("EncodeContext::encode_info_for_closure({:?})", def_id);

let tables = self.tcx.typeck_tables_of(def_id);
// FIXME(eddyb) would `tcx.type_of(def_id)` work as well?
Copy link
Member

Choose a reason for hiding this comment

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

Can you try that? It looks like it should.

Copy link
Member Author

Choose a reason for hiding this comment

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

I suppose it's easy enough to check.

@@ -635,13 +641,8 @@ impl EncodeContext<'tcx> {
let data = VariantData {
ctor_kind: variant.ctor_kind,
discr: variant.discr,
// FIXME(eddyb) deduplicate these with `encode_enum_variant_ctor`.
// FIXME(eddyb) deduplicate this with `encode_enum_variant_ctor`.
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what "duplicate this with" means. Do you mean "keep this in sync with"?

Copy link
Member Author

Choose a reason for hiding this comment

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

"deduplicate" as in there should be a helper or (even better) this code should exist only in one place.
The comment is old anyway, I think it predates @petrochenkov's revamp of how enum/struct ctors work.

@@ -660,6 +661,10 @@ impl EncodeContext<'tcx> {
self.encode_deprecation(def_id);
self.encode_item_type(def_id);
if variant.ctor_kind == CtorKind::Fn {
if let Some(ctor_def_id) = variant.ctor_def_id {
// FIXME(eddyb) deduplicate this with `encode_enum_variant_ctor`.
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

@eddyb eddyb force-pushed the more-query-like-cross-crate-tables branch from 9af9827 to 371cc39 Compare October 22, 2019 11:22
@@ -1321,10 +1328,12 @@ impl EncodeContext<'tcx> {
fn encode_info_for_closure(&mut self, def_id: DefId) {
debug!("EncodeContext::encode_info_for_closure({:?})", def_id);

let tables = self.tcx.typeck_tables_of(def_id);
// NOTE(eddyb) `tcx.type_of(def_id)` isn't used because it's fully generic,
// including on the signature, which is inferred in `typeck_tables_of.
Copy link
Member

Choose a reason for hiding this comment

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

Thanks for finding that out! Makes sense.

@michaelwoerister
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Oct 22, 2019

📌 Commit 371cc39 has been approved by michaelwoerister

@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 Oct 22, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Oct 22, 2019
…ables, r=michaelwoerister

rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.

This is an attempt at a part of rust-lang#65407, i.e. moving parts of cross-crate "metadata" into tables that match queries more closely.

Three new tables should be enough to see some perf/metadata size changes.
(need to do something similar to rust-lang#59953 (comment))

There are other bits of data that could be made into tables, but they can be more compact so the impact would likely be not as bad, and they're also more work to set up.
Centril added a commit to Centril/rust that referenced this pull request Oct 23, 2019
…ables, r=michaelwoerister

rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.

This is an attempt at a part of rust-lang#65407, i.e. moving parts of cross-crate "metadata" into tables that match queries more closely.

Three new tables should be enough to see some perf/metadata size changes.
(need to do something similar to rust-lang#59953 (comment))

There are other bits of data that could be made into tables, but they can be more compact so the impact would likely be not as bad, and they're also more work to set up.
Centril added a commit to Centril/rust that referenced this pull request Oct 23, 2019
…ables, r=michaelwoerister

rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.

This is an attempt at a part of rust-lang#65407, i.e. moving parts of cross-crate "metadata" into tables that match queries more closely.

Three new tables should be enough to see some perf/metadata size changes.
(need to do something similar to rust-lang#59953 (comment))

There are other bits of data that could be made into tables, but they can be more compact so the impact would likely be not as bad, and they're also more work to set up.
bors added a commit that referenced this pull request Oct 24, 2019
Rollup of 12 pull requests

Successful merges:

 - #64178 (More Clippy fixes for alloc, core and std)
 - #65144 (Add Cow::is_borrowed and Cow::is_owned)
 - #65193 (Lockless LintStore)
 - #65479 (Add the `matches!( $expr, $pat ) -> bool` macro)
 - #65518 (Avoid ICE when checking `Destination` of `break` inside a closure)
 - #65583 (rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref.)
 - #65641 (Derive `Rustc{En,De}codable` for `TokenStream`.)
 - #65648 (Eliminate `intersect_opt`.)
 - #65657 (Remove `InternedString`)
 - #65691 (Update E0659 error code long explanation to 2018 edition)
 - #65696 (Fix an issue with const inference variables sticking around under Chalk + NLL)
 - #65704 (relax ExactSizeIterator bound on write_bytes)

Failed merges:

r? @ghost
@bors bors merged commit 371cc39 into rust-lang:master Oct 24, 2019
@eddyb eddyb deleted the more-query-like-cross-crate-tables branch October 24, 2019 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants