-
Notifications
You must be signed in to change notification settings - Fork 422
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
perf: fast path operations for small non-native values #1326
Conversation
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.
lgtm. Shouldn't we also have fast path for Div / Inv / Sqrt ?
We should. I'll see how we could be able to implement them. |
Added fast paths to Div/Sqrt methods. For inverse we don't support inverse of zero (different from gnark-crypto imo where we take inverse of zero to be zero), so omitted it. Also added test for checking that the fast paths are complete against short zero (on zero limbs) and large zero. |
Description
This PR enforces small non-native values to work on zero or one limb. I also added some fast-path operations when we can deduce the result without needing to perform any operations (mul by zero for example).
Also adds a few more emulation parameters useful for implementing small-fields.
Type of change
How has this been tested?
Existing tests succeed
How has this been benchmarked?
Updated the stats.
Checklist:
golangci-lint
does not output errors locally