Optimize AddMod for small reduced moduli - #222
Open
perfloop-agent wants to merge 2 commits into
Open
Conversation
perfloop-agent
force-pushed
the
perfloop-pr-open-m9z3z5h7be
branch
from
August 17, 2026 22:36
52f381a to
a701252
Compare
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.
Summary
AddModoperands, plus direct scalar reduction for eligible one-word sums.Benchmark
Workload:
AddMod reduced operands / 64-bit modulusns/opWorkload:
AddMod reduced operands / 128-bit modulusns/opWorkload:
AddMod reduced operands / 192-bit modulusns/opWorkload:
AddMod unreduced operand / 64-bit modulusns/opWorkload:
AddMod operands at the modulus / 64-bit modulusns/opWorkload:
AddMod operands at the modulus / 128-bit modulusns/opWorkload:
AddMod operands at the modulus / 192-bit modulusns/opTest plan
go test ./... -count=1golangci-lint rungo test . -run - -fuzz FuzzAddModSmallModulus -fuzztime 20sgo test . -run - -fuzz FuzzTernaryOperations -fuzztime 20senv GOARCH=386 go test -c -o /tmp/uint256.test-386 . && env GOARCH=ppc64 go test -c -o /tmp/uint256.test-ppc64 .Checks: 5 passed.
Generated by Perfloop. Human sponsor: Tomás Senart. Measurements and checks.