-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
A trait's local impls are trivially coherent if there are no impls. #120834
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
A trait's local impls are trivially coherent if there are no impls. This avoids creating a dependency edge on the hir or the specialization graph This may resolve part of the performance issue of rust-lang#120558
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.
unfortunate if this is necessary for perf
r=me after perf + comment
@@ -120,11 +120,11 @@ pub fn provide(providers: &mut Providers) { | |||
} | |||
|
|||
fn coherent_trait(tcx: TyCtxt<'_>, def_id: DefId) -> Result<(), ErrorGuaranteed> { | |||
let Some(impls) = tcx.all_local_trait_impls(()).get(&def_id) else { return Ok(()) }; |
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.
please explain why we early return here and why this is sound
This avoids creating a dependency edge on the hir or the specialization graph
I think the change is good by itself. Avoiding directly accessing the HIR except in the error paths is always an improvement for incremental. |
for perf/incremental yes, but it does add complexity :< i would not add this special-case to a formalization of rust :p |
the order of operations should not matter in a formalization. We could probably just move the specialization graph query call out of the |
Avoid accessing the HIR in the happy path of `coherent_trait` based on rust-lang#120834 This may resolve part of the performance issue of rust-lang#120558
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (7c63899): comparison URL. Overall result: ✅ improvements - no action neededBenchmarking 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 Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 661.327s -> 662.269s (0.14%) |
@bors r=lcnr |
@bors r- I only pushed the new comment on the other PR and forgot it here |
0727f9a
to
e2349ea
Compare
@bors r=lcnr |
☀️ Test successful - checks-actions |
Finished benchmarking commit (de4d615): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countThis is a highly reliable metric that was used to determine the overall result at the top of this comment.
Max RSS (memory usage)ResultsThis 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.
CyclesResultsThis 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.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 664.268s -> 663.665s (-0.09%) |
This avoids creating a dependency edge on the hir or the specialization graph
This may resolve part of the performance issue of #120558