Skip to content

Precompute point multiplication results in pedersen#380

Merged
yelhousni merged 1 commit intoConsensys:developfrom
omerfirmak:elim-pedersen-alloc
Apr 14, 2023
Merged

Precompute point multiplication results in pedersen#380
yelhousni merged 1 commit intoConsensys:developfrom
omerfirmak:elim-pedersen-alloc

Conversation

@omerfirmak
Copy link
Copy Markdown
Contributor

Provides 5x performance improvement

@omerfirmak
Copy link
Copy Markdown
Contributor Author

@yelhousni, any chance we get an eye on this?

@yelhousni yelhousni self-requested a review April 13, 2023 10:27
@yelhousni yelhousni self-assigned this Apr 13, 2023
@yelhousni
Copy link
Copy Markdown
Collaborator

@yelhousni, any chance we get an eye on this?

So the point is instead of computing highPart*p2 + lowPart * p1 you precompute a table of multiples of p1 and p2 that you later lookup?

@omerfirmak
Copy link
Copy Markdown
Contributor Author

omerfirmak commented Apr 13, 2023

@yelhousni, any chance we get an eye on this?

So the point is instead of computing highPart*p2 + lowPart * p1 you precompute a table of multiples of p1 and p2 that you later lookup?

Yeah, pretty much.

16 values are precomputed for each nibble in highPart and lowPart.

Then according to values of each nibble one of those values is selected per nibble and they are all summed up for the end result.

So we are replacing 2 scalar multiplications with multiple point additions.

@yelhousni
Copy link
Copy Markdown
Collaborator

Right! I remember proposing something in these lines: #327 (comment)

Copy link
Copy Markdown
Collaborator

@yelhousni yelhousni left a comment

Choose a reason for hiding this comment

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

LGTM

@omerfirmak
Copy link
Copy Markdown
Contributor Author

Thanks! Anything I can help with to get this merged?

@yelhousni yelhousni merged commit e500f2f into Consensys:develop Apr 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants