Skip to content
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

Simplify Poly multiplication, speed up interpolation. #23

Merged
merged 3 commits into from
Sep 3, 2018
Merged

Conversation

afck
Copy link
Collaborator

@afck afck commented Sep 3, 2018

This reduces time for interpolation by about 20% on my machine.

Also add more Mul implementations.

src/poly.rs Outdated
Err(e) => panic!("Failed to create a new `Poly` duing muliplication: {}", e),
let rhs = rhs.borrow();
let mut coeff = vec![Fr::zero(); self.coeff.len() + rhs.borrow().coeff.len() - 1];
let mut s = SecretKey::default(); // Temporary value will be zeroed on drop.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely an abuse of SecretKey, I agree that a Secret type (issue #24) should be added for situations such as these.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I removed it and added back the TODO.

Also add more `Mul` implementations.
@afck
Copy link
Collaborator Author

afck commented Sep 3, 2018

I added another commit which speeds up interpolation by an additional ~45% on my machine. Division is expensive!

@afck
Copy link
Collaborator Author

afck commented Sep 3, 2018

And another one, which gives between 25% (degree 5) and 84% (degree 40) speedup.

@afck afck merged commit ded335f into master Sep 3, 2018
@afck afck deleted the afck-opt branch September 3, 2018 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants