[integer] Improve BigUInt subtraction with SIMD
#102
Merged
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 enhancements to the BigUInt benchmarks and arithmetic operations, focusing on subtraction benchmarks, SIMD optimizations, and new arithmetic methods. The changes improve performance, add comprehensive benchmarking capabilities, and refine the implementation of subtraction and addition operations.
SIMD Optimizations for Arithmetic Operations:
subtract_simd) for improved performance, replacing traditional methods insubtractandsubtract_inplace. (src/decimojo/biguint/arithmetics.mojo) [1] [2]add_simd) and optimizedadd_inplacewith SIMD operations. (src/decimojo/biguint/arithmetics.mojo) [1] [2]New Arithmetic Methods:
add_slices) and multiplication (multiply_inplace_by_uint32), expanding functionality for BigUInt arithmetic. (src/decimojo/biguint/arithmetics.mojo) [1] [2]normalize_carriesto handle carry propagation efficiently during arithmetic operations. (src/decimojo/biguint/arithmetics.mojo) [1] [2]Enhancements to BigUInt Benchmarks:
bench_biguint_subtractionmodule for benchmarking BigUInt subtraction against Python'sint, including detailed logging and performance comparison across various test cases. (benches/biguint/bench_biguint_subtraction.mojo)benches/biguint/bench.mojoto include subtraction benchmarks in the menu and execution logic. (benches/biguint/bench.mojo) [1] [2] [3]Bug Fixes and Refinements:
multiply_slicesby ensuring consistent casting ofBigUInt.BASEvalues. (src/decimojo/biguint/arithmetics.mojo)normalize_carries("crray" → "carry"). (src/decimojo/biguint/arithmetics.mojo)