Skip to content

optimize AddMod where modulus is 4-limbs wide and x/y highest limb is less than or equal to modulus highest limb#120

Merged
holiman merged 2 commits intoholiman:masterfrom
jwasinger:optimize-addmod
Dec 29, 2022
Merged

optimize AddMod where modulus is 4-limbs wide and x/y highest limb is less than or equal to modulus highest limb#120
holiman merged 2 commits intoholiman:masterfrom
jwasinger:optimize-addmod

Conversation

@jwasinger
Copy link
Copy Markdown
Contributor

uint256 master:

BenchmarkAddMod/small/uint256-4                 71864941                14.78 ns/op
BenchmarkAddMod/mod64/uint256-4                 45851817                23.58 ns/op
BenchmarkAddMod/mod128/uint256-4                23512131                49.20 ns/op
BenchmarkAddMod/mod192/uint256-4                22141264                53.37 ns/op
BenchmarkAddMod/mod256/uint256-4                55604551                21.38 ns/op

this PR:

BenchmarkAddMod/small/uint256-4                 74203911                14.75 ns/op
BenchmarkAddMod/mod64/uint256-4                 44762869                23.61 ns/op
BenchmarkAddMod/mod128/uint256-4                22504081                49.59 ns/op
BenchmarkAddMod/mod192/uint256-4                21490502                52.70 ns/op
BenchmarkAddMod/mod256/uint256-4                65233677                17.39 ns/op

benchmarks ran with turbo-boost disabled so there is little deviation in the results between runs.

@codecov
Copy link
Copy Markdown

codecov bot commented Sep 12, 2022

Codecov Report

Merging #120 (01d9874) into master (78905e8) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##            master      #120   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines         1403      1418   +15     
=========================================
+ Hits          1403      1418   +15     

@holiman holiman merged commit 9c4de98 into holiman:master Dec 29, 2022
@holiman
Copy link
Copy Markdown
Owner

holiman commented Dec 29, 2022

Thanks, sorry for letting it sit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants