Skip to content

Conversation

@yelhousni
Copy link
Collaborator

@yelhousni yelhousni commented Jun 11, 2024

Description

Currently for affine Add, Sub and Double, we convert both points to Jacobian coordinates and do the arithmetic there. Instead, in this PR, we convert only one point and do mixed arithmetic. Formulas for AddMixed are already implemented in gnark-crypto and here we add the implementation of DoubleMixed as per EFD.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • Added a test for 2*P == double(P) + P - P which checks all the Add, Sub and Double affine methods.

How has this been benchmarked?

e.g. BLS12-381 G1 and G2 additions on a M1 macbook Air:

benchmark                  old ns/op     new ns/op     delta
BenchmarkG1AffineAdd-8     4359          4207          -3.49%
BenchmarkG2AffineAdd-8     6195          5681          -8.30%

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@yelhousni yelhousni requested a review from gbotrel June 11, 2024 12:29
@yelhousni yelhousni self-assigned this Jun 11, 2024
@yelhousni yelhousni requested a review from ThomasPiellard June 11, 2024 12:46
@yelhousni yelhousni added this to the v0.10.0 milestone Jun 11, 2024
@yelhousni yelhousni merged commit 364bbce into master Jun 11, 2024
@yelhousni yelhousni deleted the perf/affine-arithmetic branch June 11, 2024 15:19
@yelhousni yelhousni mentioned this pull request Jun 12, 2024
9 tasks
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.

3 participants