Uh oh!
There was an error while loading. Please reload this page.
Improve assert_eq! and assert_ne! - #79100
Conversation
rust-highfive
commented
Nov 16, 2020
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
550d4de to
f1e7052CompareDoes this improves runtime performance?
I can't seemed to notice the difference in the assembly.
Looks nice but I wonder if we need 2x/4x the trait objects? Is it possible to have one |
Uh oh!
There was an error while loading. Please reload this page.
The difference is not in the fast path, but in the panicking one.
The only formatting that change between |
Yes, but doesn't the current implementation makes it another function which doubles the code if a user use Not sure about the |
pickfire
commented
Nov 16, 2020
Diffing the two assembly outputs seemed to give me nothing, are you sure you posted the correct link? Or maybe I copied the wrong thing? |
a1phyr
commented
Nov 16, 2020
Yes, it does. We can add an
Well, it could, but we definitely want to keep a separate generic function when there is no |
a1phyr
commented
Nov 16, 2020
You don't have any difference between |
andjo403
commented
Nov 16, 2020
think that @pickfire expected something like this https://rust.godbolt.org/z/4co4f1 where there is a diff between two editors that implement the same thing in two ways. I think that I split @a1phyr:s example correct in that godbolt link. |
a1phyr
commented
Nov 16, 2020
@andjo403 Oh, I see. I didn't know you could produce diffs like that in Godbold. |
0c9f27d to
5d79f11CompareThis is very strange, some tests fail but seem totally unrelated (eg this test), and I'm not sure what to do about them. Anyway, let's see if it improves compile time @bors try @rust-timer queue |
rust-timer
commented
Nov 17, 2020
Insufficient permissions to issue commands to rust-timer. |
bors
commented
Nov 17, 2020
@a1phyr: 🔑 Insufficient privileges: not in try users |
1 similar comment
bors
commented
Nov 17, 2020
@a1phyr: 🔑 Insufficient privileges: not in try users |
rust-timer
commented
Nov 17, 2020
Insufficient permissions to issue commands to rust-timer. |
pickfire
commented
Nov 17, 2020
@andjo403 Oh, I didn't know you can produce diff in godbolt. It seemed like the assembly lines increased. |
pickfire
commented
Nov 17, 2020
Updated godbolt to include 6 functions, it seemed like the number of assembly lines increased, removing Merging the one with |
a1phyr
commented
Nov 18, 2020
Can someone start rust-timer to see if this has a positive impact on build time ? And also, does someone has a clue what makes this test fail ? It does not seem related to my changes. |
pickfire
commented
Nov 18, 2020
jyn514
commented
Nov 18, 2020
@pickfire please don't ping me specifically for perf runs, there's a Zulip stream for that. @a1phyr are you sure it makes sense to measure the perf before fixing the tests? Your fix might itself have a perf impact. |
a1phyr
commented
Nov 18, 2020
I think the only changes that I have left to do are tests themselves (eg changing a mir output), but you're right that we should wait them to be fixed. |
jyn514
commented
Nov 18, 2020
@bors try @rust-timer queue |
rust-timer
commented
Nov 18, 2020
Awaiting bors try build completion |
bors
commented
Nov 18, 2020
⌛ Trying commit 0dbf6d0f280da53dfadc453a699d01b577a33a4b with merge 7827eb84fe5a82fab0dcc16f6eb5121188f2846e... |
tmiasko
commented
Feb 14, 2021
Looking at last bors failure, it is likely that you will have to set |
Thanks ! I didn't know about the The test should pass now. |
a1phyr
commented
Feb 20, 2021
@m-ou-se I don't think I can retry myself, could you do it please ? |
m-ou-se
commented
Feb 20, 2021
Oh sorry, missed your previous message. @bors r+ rollup=maybe |
bors
commented
Feb 20, 2021
📌 Commit 7333759 has been approved by |
panstromek
commented
Feb 20, 2021
Note: this should probably be |
jyn514
commented
Feb 20, 2021
@bors rollup=never |
jyn514
commented
Feb 20, 2021
also @m-ou-se |
Oh I'm aware of |
bors
commented
Feb 21, 2021
bors
commented
Feb 21, 2021
☀️ Test successful - checks-actions |
rust-log-analyzer
commented
Feb 21, 2021
A job failed! Check out the build log: (web)(plain) Click to see the possible cause of the failure (guessed by this bot) |
| Some(args) => panic!( | ||
| r#"assertion failed: `(left {} right)` | ||
| left: `{:?}`, | ||
| right: `{:?}: {}`"#, |
There was a problem hiding this comment.
Was the change that moves : {} inside the ` quotes intentional?
The panic message now looks suboptimal to me: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=0cbe6c5669d0b7458c6d9f67a3ea7518
Nightly
right: `3: 1 + 1 should definitely be 3`', src/main.rs:2:5
Stable
right: `3`: 1 + 1 should definitely be 3', src/main.rs:2:5
(In case it was unintentional, I have a patch.)
There was a problem hiding this comment.
@hyd-dev oh, good catch! Can you send that patch as a PR? (Feel free to assign me with r? @m-ou-se.)
Fix panic message of `assert_failed_inner` cc rust-lang#79100 (comment) r? `@m-ou-se`
Fix panic message of `assert_failed_inner` cc rust-lang#79100 (comment) r? ``@m-ou-se``
Debug-print result when an unstable fingerprint is detected Helps with issues like rust-lang#83311 I had previously tried to do this in rust-lang#80692, but it had a significant performance impact (even though the code was never actually run). Hopefully, this will be better now that rust-lang#79100 has been merged.
This PR improves
assert_eq!andassert_ne!by moving the panicking code in an external function.It does not change the fast path, but the move of the formatting in the cold path (the panic) may have a positive effect on in instruction cache use and with inlining.
Moreover, the use of trait objects instead of generic may improve compile times for
assert_eq!-heavy code.Godbolt link:
https://rust.godbolt.org/z/TYa9MTUpdated: https://rust.godbolt.org/z/bzE84x