Skip to content
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

Merged
merged 1 commit into from
Aug 4, 2021

Conversation

hkratz
Copy link
Contributor

@hkratz hkratz commented Jul 15, 2021

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.

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.
@rust-highfive
Copy link
Collaborator

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 15, 2021
@JohnTitor
Copy link
Member

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 27, 2021
@bors
Copy link
Contributor

bors commented Jul 27, 2021

⌛ Trying commit a3fb1d6 with merge 21bb34363f449dc5907f72abf77c2b066ec467f5...

@bors
Copy link
Contributor

bors commented Jul 27, 2021

☀️ Try build successful - checks-actions
Build commit: 21bb34363f449dc5907f72abf77c2b066ec467f5 (21bb34363f449dc5907f72abf77c2b066ec467f5)

@rust-timer
Copy link
Collaborator

Queued 21bb34363f449dc5907f72abf77c2b066ec467f5 with parent fd853c0, future comparison URL.

@rust-timer
Copy link
Collaborator

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
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 27, 2021
Copy link
Member

@JohnTitor JohnTitor left a 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.

@hkratz
Copy link
Contributor Author

hkratz commented Aug 4, 2021

@yaahc Could you please have a look?

@m-ou-se
Copy link
Member

m-ou-se commented Aug 4, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Aug 4, 2021

📌 Commit a3fb1d6 has been approved by m-ou-se

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 4, 2021
@m-ou-se m-ou-se assigned m-ou-se and unassigned yaahc Aug 4, 2021
@bors
Copy link
Contributor

bors commented Aug 4, 2021

⌛ Testing commit a3fb1d6 with merge 7f3dc04...

@bors
Copy link
Contributor

bors commented Aug 4, 2021

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 7f3dc04 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Aug 4, 2021
@bors bors merged commit 7f3dc04 into rust-lang:master Aug 4, 2021
@rustbot rustbot added this to the 1.56.0 milestone Aug 4, 2021
@hkratz hkratz deleted the simplify_wrapping_neg branch August 4, 2021 22:02
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 9, 2022
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.
RalfJung pushed a commit to RalfJung/miri that referenced this pull request Dec 11, 2022
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.
thomcc pushed a commit to tcdi/postgrestd that referenced this pull request Feb 10, 2023
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants