-
Notifications
You must be signed in to change notification settings - Fork 1
[integer] Optimize BigUInt addition and subtraction with SIMD and early stop tricks
#101
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant updates to the
bench_biguintbenchmarking suite, optimizes arithmetic operations in theBigUIntandBigDecimalmodules, and refactors method names for clarity and consistency. Additionally, new benchmarking cases and constants are added to improve performance testing and support for larger numbers.Arithmetic Optimizations:
src/decimojo/bigdecimal/arithmetics.mojo: Refactored methods to replacescale_up_by_power_of_10andscale_down_by_power_of_10withmultiply_by_power_of_tenandfloor_divide_by_power_of_ten, improving naming consistency and clarity. [1] [2] [3]src/decimojo/biguint/biguint.mojo: Removed redundantadd_inplace_by_1method and replaced it with a more generaladd_inplace_by_uint32for optimized addition operations. [1] [2]Refactoring and Enhancements:
src/decimojo/biguint/biguint.mojo: Renamed methods (e.g.,scale_up_by_power_of_10→multiply_by_power_of_ten) for consistency across the codebase and introducedVECTOR_WIDTHconstant for SIMD-based arithmetic optimizations. [1] [2]src/decimojo/bigdecimal/comparison.mojo: Updated comparison logic to use the newly renamedmultiply_by_power_of_tenmethod for scaling coefficients.Benchmarking Updates:
benches/biguint/bench_biguint_add.mojo: Added five new addition benchmark cases for larger word sizes (e.g., 4096 words + 2048 words) to test scalability.benches/biguint/bench_biguint_multiply.mojo: Expanded multiplication benchmarks to include 12 new cases with varying word sizes, introducing reduced iterations for very large numbers to optimize runtime.benches/biguint/bench_biguint_multiply_complexity.mojo: Adjusted test sizes to start from 8 words instead of 32 and updated iteration logic for benchmarking complexity. [1] [2]These changes collectively enhance the code's readability, scalability, and performance, especially for operations involving large numbers and benchmarking scenarios.