-
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
[WIP] cstore: Add a new caching layer for data decoded from resolver #89059
Conversation
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 0d937e9d79af47aeae19877210cc568285eae27a with merge 4dd94872d389336d4dbbb73ba19e70bcd9473a01... |
☀️ Try build successful - checks-actions |
Queued 4dd94872d389336d4dbbb73ba19e70bcd9473a01 with parent a58db2e, future comparison URL. |
self.root.name, | ||
self.cnum, | ||
) | ||
}, |
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.
DefKind
is very cheap to decode I think.
rust/compiler/rustc_hir/src/def.rs
Lines 55 to 119 in c7dbe7a
pub enum DefKind { | |
// Type namespace | |
Mod, | |
/// Refers to the struct itself, [`DefKind::Ctor`] refers to its constructor if it exists. | |
Struct, | |
Union, | |
Enum, | |
/// Refers to the variant itself, [`DefKind::Ctor`] refers to its constructor if it exists. | |
Variant, | |
Trait, | |
/// Type alias: `type Foo = Bar;` | |
TyAlias, | |
/// Type from an `extern` block. | |
ForeignTy, | |
/// Trait alias: `trait IntIterator = Iterator<Item = i32>;` | |
TraitAlias, | |
/// Associated type: `trait MyTrait { type Assoc; }` | |
AssocTy, | |
/// Type parameter: the `T` in `struct Vec<T> { ... }` | |
TyParam, | |
// Value namespace | |
Fn, | |
Const, | |
/// Constant generic parameter: `struct Foo<const N: usize> { ... }` | |
ConstParam, | |
Static, | |
/// Refers to the struct or enum variant's constructor. | |
/// | |
/// The reason `Ctor` exists in addition to [`DefKind::Struct`] and | |
/// [`DefKind::Variant`] is because structs and enum variants exist | |
/// in the *type* namespace, whereas struct and enum variant *constructors* | |
/// exist in the *value* namespace. | |
/// | |
/// You may wonder why enum variants exist in the type namespace as opposed | |
/// to the value namespace. Check out [RFC 2593] for intuition on why that is. | |
/// | |
/// [RFC 2593]: https://github.com/rust-lang/rfcs/pull/2593 | |
Ctor(CtorOf, CtorKind), | |
/// Associated function: `impl MyStruct { fn associated() {} }` | |
AssocFn, | |
/// Associated constant: `trait MyTrait { const ASSOC: usize; }` | |
AssocConst, | |
// Macro namespace | |
Macro(MacroKind), | |
// Not namespaced (or they are, but we don't treat them so) | |
ExternCrate, | |
Use, | |
/// An `extern` block. | |
ForeignMod, | |
/// Anonymous constant, e.g. the `1 + 2` in `[u8; 1 + 2]`, or `const { 1 + 2}` | |
AnonConst, | |
/// Opaque type, aka `impl Trait`. | |
OpaqueTy, | |
Field, | |
/// Lifetime parameter: the `'a` in `struct Foo<'a> { ... }` | |
LifetimeParam, | |
/// A use of [`global_asm!`]. | |
GlobalAsm, | |
Impl, | |
Closure, | |
Generator, | |
} |
Finished benchmarking commit (4dd94872d389336d4dbbb73ba19e70bcd9473a01): comparison url. Summary: This change led to large relevant mixed results 🤷 in compiler performance.
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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
0d937e9
to
3c24f7c
Compare
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 3c24f7cb3f1a0d4e420033e9cc962121ecb32667 with merge f764f6372fa6071b7d65617b2fc04123b516bdbf... |
☀️ Try build successful - checks-actions |
Queued f764f6372fa6071b7d65617b2fc04123b516bdbf with parent 5438ee4, future comparison URL. |
Finished benchmarking commit (f764f6372fa6071b7d65617b2fc04123b516bdbf): comparison url. Summary: This change led to large relevant regressions 😿 in compiler performance.
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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
3c24f7c
to
89eb72e
Compare
☀️ Try build successful - checks-actions |
Queued 6cc1b9a099c33502cb7d0d6f0df626a37b5997f9 with parent 60e70cc, future comparison URL. |
Finished benchmarking commit (6cc1b9a099c33502cb7d0d6f0df626a37b5997f9): comparison url. Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.
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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never |
rustc_metadata: Merge `get_ctor_def_id` and `get_ctor_kind` Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag. A small optimization and cleanup extracted from rust-lang#89059.
resolve: Minor miscellaneous cleanups from rust-lang#89059 `@bors` rollup=always
…askrgr Rollup of 7 pull requests Successful merges: - rust-lang#90586 (Relax priv-in-pub lint on generic bounds and where clauses of trait impls.) - rust-lang#92112 (Fix the error of checking `base_expr` twice in type_changing_struct_update) - rust-lang#92147 (rustc_builtin_macros: make asm mod public for rustfmt) - rust-lang#92161 (resolve: Minor miscellaneous cleanups from rust-lang#89059) - rust-lang#92264 (Remove `maybe_uninit_extra` feature from Vec docs) - rust-lang#92303 (Add test cases for issue rust-lang#26186) - rust-lang#92307 (Fix minor typos) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Implement something to address https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/.22Querifying.22.20early.20cstore.20accesses/near/253737343
One obvious further optimization would be to use some kind of arena to avoid cloning heavy decoded data like vectors.