-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
factor:performance tuning #9261
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
base: main
Are you sure you want to change the base?
Conversation
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
|
could you please run hyperfine with the three programs? gnu, without the patch and with the patch |
|
GNU testsuite comparison: |
Implementation DetailsGMP 6.3.0 and GNU coreutils 9.5 were built and installed from source Created factor_numbers_u128_repeat.txt (60 lines) as benchmark input, containing 6 composite numbers ranging from 64 to 128 bits repeated 10 times. Confirmed factorization completion across all 3 implementations and reran Hyperfine.
To reduce variance, we adjusted to 3 warm-ups + 12 measurements, but the Rust version still shows relatively high dispersion due to its randomized algorithm. For greater stability, consider running at times of low system load or using CPU pinning. For factor_numbers.txt (max ~260 bits), both the GNU version and the patched version achieved complete factorization. The old implementation returned |
Merging this PR will not alter performance
Comparing Footnotes
|
|
GNU testsuite comparison: |
09d5c51 to
fe34cf2
Compare
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
Any idea why codspeed does not detect it? |
If I were to consider it, I would create test cases with large integers. |
|
GNU testsuite comparison: |
1 similar comment
|
GNU testsuite comparison: |
- Add num-integer dependency to support enhanced numeric operations. - Refactor factorization logic to avoid redundant parsing and optimize u64/u128 paths. - Improve handling of non-positive and invalid inputs to align with GNU factor behavior. - Enhance large BigUint factoring with additional algorithms and clearer limitations.
0dfc79b to
aea625a
Compare
- Integrate jemalloc allocator in factor benchmark suite for better memory profiling - Add jemalloc-ctl and jemallocator dependencies with OS-specific dev-dependencies - Implement logging of allocated and resident memory stats before benchmark runs - Update CI workflow to show output for uu_factor benchmarks without suppressing it - Enables precise memory usage tracking on Linux, macOS, and FreeBSD during benchmarking
Add technical terms for memory allocation libraries to the cspell dictionary to prevent false positives in spellchecking.
|
GNU testsuite comparison: |
|
many jobs are failing |
Replace positional placeholders with named parameters in println! macro for improved readability and consistency with modern Rust formatting.
Install GNU make (gmake) in the FreeBSD workflow prepare step to support building and testing, as the process requires GNU make utilities alongside existing tools like jq and GNU coreutils.
Ignore security advisory RUSTSEC-2024-0436 for the unmaintained "paste" crate, which is used via jemalloc-ctl in the uu_factor benchmark. This suppresses the warning without impacting functionality, as the crate is not actively maintained.
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
GNU testsuite comparison: |
|
please add a test to verify that factor 15111234931751377131713914373267893176342349831 is indeed fixed |
The jemalloc allocator and related dependencies (jemalloc-ctl, jemalloc-sys, paste) were removed from the factor utility's benchmark code. This change simplifies the dependency tree and removes platform-specific allocator logic that was only used for memory profiling in benchmarks. The benchmark functionality remains intact, just without jemalloc-specific memory statistics collection. Additionally, a new regression test was added to verify correct factorization of a very large number (15111234931751377131713914373267893176342349831) to ensure the utility handles large inputs properly.
…ger literals This commit adds numeric separators (`_`) to large integer literals in the factor.rs file to improve code readability. The changes include: - Adding separators to base arrays for Miller-Rabin primality testing - Adding separators to LCG constants used in Pollard's rho algorithm - Adding separators to LCG default seed value These changes make the large numeric values easier to read and understand without changing any functionality.
Reformatted the bases_64 array initialization to use proper indentation and line breaks for better code readability. The array elements are now aligned vertically, making the code easier to read and maintain.
|
GNU testsuite comparison: |
Performance improvement for large numbers
fix this issue
https://bugs.launchpad.net/ubuntu/+source/rust-coreutils/+bug/2131212
related
#10262