-
Notifications
You must be signed in to change notification settings - Fork 335
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: revisiting field extensions in std/
#1110
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.
Looks perfect. Left a small suggestion, which is not an issue now, but may lead to a hard-to-trace bug in the future when we add multiplication to Ext6.Square after creating c3
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.
Description
Revisiting quadratic and cubic field extensions using Karatsuba, Toom-Cook-3 and Chung-Hasan (sq). Basically experiments show that Karatsuba is better but this PR just saves some (emulated) subtractions here and there. Direct extensions using Toom-Cook work nice; for example an (unoptimized) version Toom-Cook-6 saves ~2k scs per multiplication (theoretically it saves 7 Fp-mul but uses more adds/subs) . However they are removed from this PR for now because the pairing implementation should be rewritten in the direct extension (Karabina, Granger-Scott, lines...), which will be in a separate PR.
Type of change
How has this been tested?
Existing tests work.
How has this been benchmarked?
PLONK verifier circuit on bw6-761:
Pairing check circuit
e(a,b)e(c,d)==1
on BN254:Pairing check circuit
e(a,b)e(c,d)==1
on BLS12-381:Checklist:
golangci-lint
does not output errors locally