-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Implement ordering chaining #37053
Comments
Add or and or_else for ordering. Fixes #37053 (see discussion in rust-lang/rfcs#1677).
Reopening because this is a tracking issue. |
@rfcbot fcp merge |
@rfcbot fcp merge |
Team member @aturon has proposed to merge this. The next step is review by the rest of the tagged teams: No concerns currently listed. Once these reviewers reach consensus, this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
ping @BurntSushi (checkbox) |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
The final comment period is now complete. |
I have some reservations about this change. I changed the code at https://github.com/jongiddy/gidsort/blob/229720e12ac9602b844c623e584dd6f876d1e3a3/src/lib.rs#L71-L74 let mut leg = compare(value, &buffer[trial]);
if leg == Ordering::Equal {
leg = when_equal;
}; let leg = compare(value, &buffer[trial]).then(when_equal); First, it's nice to have fewer lines and one less But the benchmark penalty was surprising. The most appropriate benchmark, Also, the big plus for the explicit version is that a non-Rust programmer could easily understand it. |
@jongiddy I diagnosed and fixed the problem - we were simply missing |
…excrichton Inline functions Ordering::{then, then_with} @jongiddy noticed bad performance due to the lack of inlining on `then` and `then_with`. I confirmed that inlining really is the culprit by creating a custom `then` function and repeating his benchmark on my machine with and without the `#[inline]` attribute. The numbers were exactly the same on my machine without the attribute. With `#[inline]` I got the same performance as I did with manually inlined implementation. The problem was reported in rust-lang#37053.
…excrichton Inline functions Ordering::{then, then_with} @jongiddy noticed bad performance due to the lack of inlining on `then` and `then_with`. I confirmed that inlining really is the culprit by creating a custom `then` function and repeating his benchmark on my machine with and without the `#[inline]` attribute. The numbers were exactly the same on my machine without the attribute. With `#[inline]` I got the same performance as I did with manually inlined implementation. The problem was reported in rust-lang#37053.
Add or and or_else for ordering. Fixes rust-lang/rust#37053 (see discussion in rust-lang/rfcs#1677).
As discussed in: rust-lang/rfcs#1677
I've already started working on this and will open a PR soon.
The text was updated successfully, but these errors were encountered: