-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Fast-path some relations via strict equality #104598
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
Fast-path some relations via strict equality #104598
Conversation
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit 3a5bf11 with merge bf7cfa7141d188772c184387e27cc0505b3dcc5c... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (bf7cfa7141d188772c184387e27cc0505b3dcc5c): 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.
|
|
||
fn fast_equate_combine(&self) -> bool { | ||
true | ||
} | ||
|
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.
should these be marked #[inline]
?
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.
perhaps that would help... 🤔
I'll try one more perf run, but unclear that this is worth the complexity... @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit d1ed286 with merge aff588effced4b8915a1406ff5b4271169c1181a... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
Finished benchmarking commit (aff588effced4b8915a1406ff5b4271169c1181a): 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.
|
@@ -29,7 +29,7 @@ pub trait TypeRelation<'tcx>: Sized { | |||
fn tag(&self) -> &'static str; | |||
|
|||
/// Returns whether or not structural equality can be used to fast-path this relation | |||
fn fast_equate_combine(&self) -> bool; | |||
fn fast_equate(&self) -> bool; |
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.
Annotate inline this declaration instead?
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.
#[inline]
means nothing on trait methods without a body.
Is this confirmed to fix #104583? I don't think the perf is enough of a win to justify to added complexity otherwise. If we want to land this, I think every one of the Also, can just make a default method with false, and only add an impl method for true. |
Yes, though I can probably reformulate this to be simpler, given that we don't have a perf win in general. Let me close this and go back to the drawing board. |
…, r=oli-obk Fast-path some binder relations A simpler approach than rust-lang#104598 Fixes rust-lang#104583 r? types
Some relations can take advantage of strict equality (that is, the
==
operator), which is far cheaper to check in some cases like substs and existential predicate lists.This also fixes #104583.
r? @ghost