-
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
Faster parsing for lower numbers for radix up to 16 (cont.) #95399
Conversation
Co-authored-by: LingMan <[email protected]>
Co-authored-by: LingMan <[email protected]>
Co-authored-by: Ivan Tham <[email protected]>
Co-authored-by: LingMan <[email protected]>
r? @scottmcm (rust-highfive has picked a reviewer for you, use r? to override) |
A mate points out that we could pull that condition out into a separate function and slather it in tests (assuming that we slap an inline always on it). I really like that idea. |
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 idea here sounds good; I've left some details comments.
One additional request: Please make sure there are a bunch of #[test]
s in the core tests that hit around the edges of the unsafe-using paths here. We run those tests in MIRI, which should help get extra checking that the unchecked usage is sound.
A mate points out that we could pull that condition out into a separate function and slather it in tests (assuming that we slap an inline always on it). I really like that idea.
Are you planning on doing this before requesting final approval?
This comment has been minimized.
This comment has been minimized.
Yeah let's get those additional tests done before we hit merge. I want to be absolutely sure about this. |
Have extracted |
This comment has been minimized.
This comment has been minimized.
I guess I could make it a public function but add something like this: #[doc(hidden)]
#[unstable(issue = "none", feature = "std_internals")] |
I realised we can use default() to get zero which seems a bit nicer. |
Right I feel happier with that now - if anyone optimised that condition in an unsafe way the test would likely catch it. |
So my assumption here is that |
This comment has been minimized.
This comment has been minimized.
Great build fails because it's really hard to figure out if a type is signed in rust... maybe it's not even possible at the moment without using FromStrRadixHelper ... |
It's just that there's a few CI builders that enable debug/overflow checks to check for mistakes in the implementations (otherwise the So that test failure is concerning. What subtraction is overflowing in the "it shouldn't overflow" path? |
H/T to @koute for pointing out an easier way to do is signed. Test failure is no more. It was just a poor is signed implementation (in the test only). |
Thanks! This looks good, and the final iteration @bors r+ |
📌 Commit 3ee7bb1 has been approved by |
☀️ Test successful - checks-actions |
Finished benchmarking commit (4e1927d): comparison url. Summary:
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression Footnotes |
Is there somewhere posted benches and\or godbolt where changes actually visible? Reading this PR, i didn't find anything, plus description don't help. |
It's retrograde for radix_36 and i8 but everything else benefits. We did have a godbolt a long while ago. I can try and set one up again. There's a bit of munging of the code to do to get something equivalent so it will take me a little time. |
Fix spelling in docs for `can_not_overflow` Introduced in rust-lang#95399
Fix spelling in docs for `can_not_overflow` Introduced in rust-lang#95399
Fix spelling in docs for `can_not_overflow` Introduced in rust-lang#95399
There's a followup PR being drafted to address the regression - I had an idea before going to sleep (we are wasting a mul). |
Fix spelling in docs for `can_not_overflow` Introduced in rust-lang/rust#95399
( Continuation of #83371 )
With LingMan's change I think this is potentially ready.