use u64 limbs in core::num::bignum - #162879
Conversation
|
Some changes occurred in float parsing cc @tgross35 |
|
Thanks for the pull request, and welcome! The Rust Project has assigned @clarfonthey (or someone else) to review your changes, you should hear from them (or someone else) within the next two weeks. Please see the contribution instructions and our LLM policy for more information. Why was this reviewer chosen?The reviewer was selected based on:
|
|
This PR was initially created as #162746
Could you post your processor type so we have an idea of what this is on? Also these don't look like the invocations to run benchmarks. |
I used the wrong command, it should be ./x bench library/coretests --test-args bignum. My CPU is AMD Ryzen 9 7940HX. After my changes I will rerun the benchmarks and update the data. |
9bd7adc to
75380c0
Compare
|
test command: I think the comparison bettween u64 and u32 can refer to rust-timer. |
75380c0 to
4f481b1
Compare
|
Well, I've learned the use of unbounded_shr(), thanks.For the macro approach, I'd like to keep the tables as-is for this round |
|
Always happy to find more uses for new libs functions. In terms of the tables, I'm okay with that, but would you mind adding a |
4f481b1 to
99a796f
Compare
|
Ok, I've polished the code as you said,thanks for your guidance. |
|
One final comment, otherwise looks good to me. Thank you for working on this! |
Co-authored-by: Clar Fon <15850505+clarfonthey@users.noreply.github.com>
|
@bors r+ rollup Thank you! |
…clarfonthey use u64 limbs in core::num::bignum The code was totally written by myself without any llm.Last time I write description with the polish of llm,but this time I write the description on my own. This pr use u64 limbs in core::num::bignum Since the unlocking of u128 in rust-lang#146277, a discussion happened in rust-lang#137887. From which I know maybe I can help making a u64 digit path. changes are as follows: 1. total capacity of bignum remains the same, 1280bits. Big32x40=>Big64x20 2. add u64 entry to SMALL_POW5. 3. update the corresponding coretests to use Big64x20. performance: I ran benchmarks on my PC,use ```text ./x test library/coretests --test-args bignum ./x test library/coretests --test-args flt2dec ./x test tidy ``` results are as follows: | Benchmark | Big32x40 (ns/iter) | Big64x20 (ns/iter) | Speedup | | ----------------------- | ------------------ | ------------------ | ------- | | `bench_big_exact_inf` | 33,568 | ~21,700 | 1.55x | | `bench_big_shortest` | 2,913 | ~1,880 | 1.55x | | `bench_big_exact_12` | 1,680 | ~1,030 | 1.63x | | `bench_big_exact_3` | 878 | ~585 | 1.50x | | `bench_small_exact_inf` | 1,353 | ~1,425 | ~1.0x | | `bench_small_exact_12` | 277 | ~220 | 1.26x | | `bench_small_exact_3` | 170 | ~134 | 1.27x | | `bench_small_shortest` | 320 | ~275 | 1.16x |
…clarfonthey use u64 limbs in core::num::bignum The code was totally written by myself without any llm.Last time I write description with the polish of llm,but this time I write the description on my own. This pr use u64 limbs in core::num::bignum Since the unlocking of u128 in rust-lang#146277, a discussion happened in rust-lang#137887. From which I know maybe I can help making a u64 digit path. changes are as follows: 1. total capacity of bignum remains the same, 1280bits. Big32x40=>Big64x20 2. add u64 entry to SMALL_POW5. 3. update the corresponding coretests to use Big64x20. performance: I ran benchmarks on my PC,use ```text ./x test library/coretests --test-args bignum ./x test library/coretests --test-args flt2dec ./x test tidy ``` results are as follows: | Benchmark | Big32x40 (ns/iter) | Big64x20 (ns/iter) | Speedup | | ----------------------- | ------------------ | ------------------ | ------- | | `bench_big_exact_inf` | 33,568 | ~21,700 | 1.55x | | `bench_big_shortest` | 2,913 | ~1,880 | 1.55x | | `bench_big_exact_12` | 1,680 | ~1,030 | 1.63x | | `bench_big_exact_3` | 878 | ~585 | 1.50x | | `bench_small_exact_inf` | 1,353 | ~1,425 | ~1.0x | | `bench_small_exact_12` | 277 | ~220 | 1.26x | | `bench_small_exact_3` | 170 | ~134 | 1.27x | | `bench_small_shortest` | 320 | ~275 | 1.16x |
…uwer Rollup of 20 pull requests Successful merges: - #160401 (sparc: make ABI consistent with clang) - #162715 (don't calculate dtors if the self ty has impossible bounds) - #162740 (stdarch subtree update) - #162824 (link Enzyme and the offload with in-tree lld if possible) - #162946 (Simplify query stack printing) - #161005 (fix: unfulfilled nested dead code lint) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - #162661 (simplify `Target::GenericParam`) - #162666 (Tidy footnote in `platform-support.md`) - #162803 (docs(num): add documentation for `NonZero::from_str`) - #162879 (use u64 limbs in core::num::bignum) - #162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - #162905 (c-variadic: add checks for windows i686) - #162906 (Move more `rustdoc-html` tests in the right location) - #162922 (An assortment of polonius tweaks) - #162929 (Update unicode_data to Unicode version 18.0.0) - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - #162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
…uwer Rollup of 19 pull requests Successful merges: - #160401 (sparc: make ABI consistent with clang) - #162715 (don't calculate dtors if the self ty has impossible bounds) - #162740 (stdarch subtree update) - #162946 (Simplify query stack printing) - #161005 (fix: unfulfilled nested dead code lint) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - #162661 (simplify `Target::GenericParam`) - #162666 (Tidy footnote in `platform-support.md`) - #162803 (docs(num): add documentation for `NonZero::from_str`) - #162879 (use u64 limbs in core::num::bignum) - #162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - #162905 (c-variadic: add checks for windows i686) - #162906 (Move more `rustdoc-html` tests in the right location) - #162922 (An assortment of polonius tweaks) - #162929 (Update unicode_data to Unicode version 18.0.0) - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - #162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
…uwer Rollup of 19 pull requests Successful merges: - #160401 (sparc: make ABI consistent with clang) - #162715 (don't calculate dtors if the self ty has impossible bounds) - #162740 (stdarch subtree update) - #162946 (Simplify query stack printing) - #161005 (fix: unfulfilled nested dead code lint) - #161246 (Normalize non-rigid aliases in ty_known_to_outlive) - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - #162661 (simplify `Target::GenericParam`) - #162666 (Tidy footnote in `platform-support.md`) - #162803 (docs(num): add documentation for `NonZero::from_str`) - #162879 (use u64 limbs in core::num::bignum) - #162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - #162905 (c-variadic: add checks for windows i686) - #162906 (Move more `rustdoc-html` tests in the right location) - #162922 (An assortment of polonius tweaks) - #162929 (Update unicode_data to Unicode version 18.0.0) - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - #162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
Rollup merge of #162879 - kiana1kaslana:bignum-u64-limbs, r=clarfonthey use u64 limbs in core::num::bignum The code was totally written by myself without any llm.Last time I write description with the polish of llm,but this time I write the description on my own. This pr use u64 limbs in core::num::bignum Since the unlocking of u128 in #146277, a discussion happened in #137887. From which I know maybe I can help making a u64 digit path. changes are as follows: 1. total capacity of bignum remains the same, 1280bits. Big32x40=>Big64x20 2. add u64 entry to SMALL_POW5. 3. update the corresponding coretests to use Big64x20. performance: I ran benchmarks on my PC,use ```text ./x test library/coretests --test-args bignum ./x test library/coretests --test-args flt2dec ./x test tidy ``` results are as follows: | Benchmark | Big32x40 (ns/iter) | Big64x20 (ns/iter) | Speedup | | ----------------------- | ------------------ | ------------------ | ------- | | `bench_big_exact_inf` | 33,568 | ~21,700 | 1.55x | | `bench_big_shortest` | 2,913 | ~1,880 | 1.55x | | `bench_big_exact_12` | 1,680 | ~1,030 | 1.63x | | `bench_big_exact_3` | 878 | ~585 | 1.50x | | `bench_small_exact_inf` | 1,353 | ~1,425 | ~1.0x | | `bench_small_exact_12` | 277 | ~220 | 1.26x | | `bench_small_exact_3` | 170 | ~134 | 1.27x | | `bench_small_shortest` | 320 | ~275 | 1.16x |
|
I expect the perf improvements in #162989 (comment) may be this, may as well confirm @rust-timer build 898e43b |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (898e43b): comparison URL. Overall result: no relevant changes - no action neededBenchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up. @rustbot label: -S-waiting-on-perf -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 3.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeResults (primary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 498.333s -> 497.77s (-0.11%) |
…uwer Rollup of 19 pull requests Successful merges: - rust-lang/rust#160401 (sparc: make ABI consistent with clang) - rust-lang/rust#162715 (don't calculate dtors if the self ty has impossible bounds) - rust-lang/rust#162740 (stdarch subtree update) - rust-lang/rust#162946 (Simplify query stack printing) - rust-lang/rust#161005 (fix: unfulfilled nested dead code lint) - rust-lang/rust#161246 (Normalize non-rigid aliases in ty_known_to_outlive) - rust-lang/rust#161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase) - rust-lang/rust#162256 (Add mentions to sync back `RELEASES.md` to the `main` branch) - rust-lang/rust#162661 (simplify `Target::GenericParam`) - rust-lang/rust#162666 (Tidy footnote in `platform-support.md`) - rust-lang/rust#162803 (docs(num): add documentation for `NonZero::from_str`) - rust-lang/rust#162879 (use u64 limbs in core::num::bignum) - rust-lang/rust#162903 (PassWrapper: adapt to LLVM reading exception model from module flag) - rust-lang/rust#162905 (c-variadic: add checks for windows i686) - rust-lang/rust#162906 (Move more `rustdoc-html` tests in the right location) - rust-lang/rust#162922 (An assortment of polonius tweaks) - rust-lang/rust#162929 (Update unicode_data to Unicode version 18.0.0) - rust-lang/rust#162930 (Use niche length type for strlen to guarantee `isize::MAX` bound) - rust-lang/rust#162960 (Guard types with unstable `Allocator` params ahead of partial stabilization)
View all comments
The code was totally written by myself without any llm.Last time I write description with the polish of llm,but this time I write the description on my own.
This pr use u64 limbs in core::num::bignum
Since the unlocking of u128 in #146277, a discussion happened in #137887. From which I know maybe I can help making a u64 digit path.
changes are as follows:
performance:
I ran benchmarks on my PC,use
results are as follows:
bench_big_exact_infbench_big_shortestbench_big_exact_12bench_big_exact_3bench_small_exact_infbench_small_exact_12bench_small_exact_3bench_small_shortest