-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Experiment: spaceship in MIR #108800
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
Experiment: spaceship in MIR #108800
Conversation
99c956d
to
01d0e9e
Compare
As mentioned in <rust-lang#108788 (comment)>, `Ord::cmp` on primitives generates a large amount of MIR, preventing (or at least discouraging) it from mir-inlining. Let's see whether making it a MIR primitive helps stuff -- derived `(Partial)Ord` in particular, if we're lucky.
01d0e9e
to
d6fa338
Compare
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
⌛ Trying commit d6fa338 with merge afab298db3408356c94adab4dfc262c869673b6d... |
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
} | ||
#[cfg(not(bootstrap))] | ||
{ | ||
crate::intrinsics::three_way_compare(*self, *other) |
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.
a question for my own understanding: is there a reason why it's better (or has to be) for this to be in a single instance of the fn cmp
rather than either #[cfg(bootstrap)] fn cmp(...)
or on the impl?
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 just put it here because it's the least copy-pasting. Doing it at other levels would work too, but would mean duplicating the #[inline]
or stability attributes, which leaves more opportunities for me to get it wrong.
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.
You don't have the duplicate the signature and the #[inline]
attribute. But it doesn't make that much of a difference (also hopefully we'll get rid of these cfg(bootstrap)
inside the standard library soon anyways🤞)
Finished benchmarking commit (afab298db3408356c94adab4dfc262c869673b6d): comparison URL. Overall result: ❌✅ regressions and improvements - 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. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @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.
|
Closing this as it was an experiment |
As mentioned in #108788 (comment),
Ord::cmp
on primitives generates a large amount of MIR, preventing (or at least discouraging) it from mir-inlining.Let's see whether making it a MIR primitive helps stuff -- derived
(Partial)Ord
in particular, if we're lucky.r? @ghost