-
Notifications
You must be signed in to change notification settings - Fork 12
opt: change polynomials to point value form #64
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
Conversation
On my machine, in a quick test,
|
Just added manual tables for MSM since I don't know any MSM libraries or more optimized versions off the top of my head. Current numbers are like this on my machine: (again, average of 100 iterations):
|
Added another optimization to MSM, now it's like this:
|
Last commit also should add another ~3% decrease to the time. |
Full Flow
|
Part of #62 |
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, but I was just thinking - would it be feasible to merge eval_at_suffix_points
and lagrange_interpolate_whole_polynomial
? That'd save some duplication
let mut result = vec![T::zero(); n_points]; | ||
|
||
for i in 0..n_known { | ||
let mut table = vec![]; |
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.
Nit: maybe worth initializing with Vec::with_capacity
to avoid some reallocations?
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.
The main thing is that the maths is essentially correct. Next, I will refactor here to achieve greater performance.
I think that it is possible but would be more trouble than it's worth, since there are many special optimizations in similarly functioning parts. |
Changes the representation and commitment of polynomials to point value form for better scaling, especially for evaluating polynomials with the domain of EC points. Assuming there are
a
revealed points andb
hidden points, previous algorithm used around2 * (a + b) * a * log_2(a)
(log from exponentiation) EC additions, this version uses arounda * b * 256
(256 from exponentiation). (Although it doesn't look like it, it might be slower with the current parameters, so further performance testing before merging would be preferable.) (Whole work is on top of #59)