-
Notifications
You must be signed in to change notification settings - Fork 201
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
Improvement/field inv pornin20 #106
Conversation
Arya Tabaie seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
return b | ||
} | ||
|
||
// Though we're defining k as a constant, this code "profoundly" assumes that the processor is 64 bit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"profoundly" assumes --> is optimized ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't make a whole lot of sense. Removing.
// approximate a big number using its uppermost and lowermost bits | ||
func approximate(x *{{.ElementName}}, n int) uint64 { | ||
|
||
if n <= 64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question, just based on the function comment; if say, n == 24, shouldn't this clear the 40 other bits to 0?
Benchmarked on a VM with an AMD EPYC 7R32 processor
For bw6-761/fp speedup ranged from 71% to 77%.
For bn254/fp speedup ranged from 43% to 65%.
Speedup on my ARM laptop was nowhere near as dramatic.
The inconsistency in the small field performance is due to higher variability in the number of outer loop iterations, a random effect that gets smoothed out in higher field size. In general, the algorithm has a good asymptotic complexity and is expected to scale well.
TODOs:
InverseOld
andmulWRegularBf
(cleanup)linearCombNonModular
,mulWRegular
,montReduceSigned
) (perf)