-
Notifications
You must be signed in to change notification settings - Fork 70
Leverage const_mut_refs; MSRV 1.83
#667
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
Conversation
5ca300b to
d72b59a
Compare
d72b59a to
b6c06b0
Compare
This version leverages the new `core::error::Error` stabilization. We plan on bumping MSRV to 1.83 before a final release to get the `const_mut_refs` stabilization (#667), so this is something of an interim bump.
This version leverages the new `core::error::Error` stabilization. We plan on bumping MSRV to 1.83 before a final release to get the `const_mut_refs` stabilization (#667), so this is something of an interim bump.
This version leverages the new `core::error::Error` stabilization. We plan on bumping MSRV to 1.83 before a final release to get the `const_mut_refs` stabilization (#667), so this is something of an interim bump.
90cf782 to
95028da
Compare
c0ebcb2 to
64b622e
Compare
acf1a26 to
522ea4a
Compare
|
Went ahead and bumped this to 1.8.3.0-beta and removed WIP/draft, though I'll hold off on merging this until 1.83 is stable. This is just the beginning of what's possible: we can rewrite pretty much all of This will also make it possible to have many more common implementations shared among |
522ea4a to
eaf2e62
Compare
Replaces macro-based code sharing between the stack-allocated and heap-allocated `*Uint` types with `const fn` using `const_mut_refs`.
eaf2e62 to
b65b985
Compare
Fixes a performance regression introduced in #667. Evidently, compiler relies a lot on knowing the slice sizes at compile time, so I'm inlining `schoolbook_multiplication()`, `schoolbook_squaring()`, and `montgomery_reduction_inner()`, so the compiler can optimize in case of `Uint`s. Benchmarks: - `wrapping ops/split_mul, U256xU256` - 26ns to 9ns - `Const Montgomery arithmetic/multiplication, U256*U256` - 41ns to 21ns - `Dynamic Montgomery arithmetic/multiplication, U256*U256` - 62ns to 44ns The effect is less pronounced for longer integers, but sill amounts to 5-10% speedup for U4096. On a higher level, this affects many `crypto-primes` benchmarks, e.g. doubles the speed of Lucas test for U128. Possible addition: I think `panic!` in these functions can be replaced with `debug_assert!`, but I don't insist on it.
Replaces macro-based code sharing between the stack-allocated and heap-allocated
*Uinttypes withconst fnusingconst_mut_refs.Stabilization of this feature is (hopefully) imminent and the PR to do so is in FCP: rust-lang/rust#129195
I will keep this a draft until the feature has actually been stabilized and made it into a stable Rust release.
Edit: stabilization is currently slated for the 1.83.0 milestone, which is set to be released on November 28th, 2024.