-
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: use a table for super_predicates, fn_sig, impl_trait_ref. #65583
rustc_metadata: use a table for super_predicates, fn_sig, impl_trait_ref. #65583
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
@bors try |
⌛ Trying commit 2c91ec26a69d472036090c56c99ad5144d213153 with merge 238668d24087abeafc989aadc78ee7c41a3c59d6... |
☀️ Try build successful - checks-azure |
@rust-timer build 238668d24087abeafc989aadc78ee7c41a3c59d6 |
Queued 238668d24087abeafc989aadc78ee7c41a3c59d6 with parent 518deda, future comparison URL. |
Finished benchmarking try commit 238668d24087abeafc989aadc78ee7c41a3c59d6, comparison URL. |
This is smaller increase than #59953 (comment), which is a good sign:
(Note that the total is compressed with XZ, but also includes |
2c91ec2
to
9af9827
Compare
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.
Looks like an improvement! r=me with the nits addressed.
src/librustc_metadata/encoder.rs
Outdated
@@ -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? |
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.
Can you try that? It looks like it should.
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.
I suppose it's easy enough to check.
src/librustc_metadata/encoder.rs
Outdated
@@ -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`. |
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.
I don't understand what "duplicate this with" means. Do you mean "keep this in sync with"?
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.
"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.
src/librustc_metadata/encoder.rs
Outdated
@@ -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`. |
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.
Same as above.
9af9827
to
371cc39
Compare
@@ -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. |
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.
Thanks for finding that out! Makes sense.
@bors r+ |
📌 Commit 371cc39 has been approved by |
…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.
…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.
…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.
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
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.