-
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
Make wrapping_neg() use wrapping_sub(), #[inline(always)] #87150
Conversation
This is a follow-up change to the fix for rust-lang#75598. It simplifies the implementation of wrapping_neg() for all integer types by just calling 0.wrapping_sub(self) and always inlines it. This leads to much less assembly code being emitted for opt-level≤1.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @yaahc (or someone else) soon. Please see the contribution instructions for more information. |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit a3fb1d6 with merge 21bb34363f449dc5907f72abf77c2b066ec467f5... |
☀️ Try build successful - checks-actions |
Queued 21bb34363f449dc5907f72abf77c2b066ec467f5 with parent fd853c0, future comparison URL. |
Finished benchmarking try commit (21bb34363f449dc5907f72abf77c2b066ec467f5): comparison url. Summary: This benchmark run did not return any significant changes. 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. @bors rollup=never |
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.
The perf results seem acceptable. The change makes sense to me, +1.
@yaahc Could you please have a look? |
@bors r+ |
📌 Commit a3fb1d6 has been approved by |
☀️ Test successful - checks-actions |
Make some trivial functions `#[inline(always)]` This is some kind of follow-up of PRs like rust-lang#85218, rust-lang#84061, rust-lang#87150. Functions that do very basic operations are made `#[inline(always)]` to avoid pessimizing them in debug builds when compared to using built-in operations directly.
Make some trivial functions `#[inline(always)]` This is some kind of follow-up of PRs like rust-lang/rust#85218, rust-lang/rust#84061, rust-lang/rust#87150. Functions that do very basic operations are made `#[inline(always)]` to avoid pessimizing them in debug builds when compared to using built-in operations directly.
Make some trivial functions `#[inline(always)]` This is some kind of follow-up of PRs like rust-lang/rust#85218, rust-lang/rust#84061, rust-lang/rust#87150. Functions that do very basic operations are made `#[inline(always)]` to avoid pessimizing them in debug builds when compared to using built-in operations directly.
This is a follow-up change to the fix for #75598. It simplifies the implementation of wrapping_neg() for all integer types by just calling 0.wrapping_sub(self) and always inlines it. This leads to much less assembly code being emitted for opt-level≤1 and thus much better performance for debug-compiled code.
Background is this discussion on the internals forum.