Skip to content

Optimize bn254 #899

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

Merged
merged 25 commits into from
Sep 13, 2024
Merged

Optimize bn254 #899

merged 25 commits into from
Sep 13, 2024

Conversation

jotabulacios
Copy link
Contributor

BN254 optimization

Description

This PR improves the paring performance by using optimized operations used in key functions.
Also it incorporates benches for the BN254.

There is still room for improvement optimizng the Miller loop and the operations for Fp6 and Fp12

Optimized algorithms:

  • Line

  • final exponentiation

    • cyclotomic_square
    • cyclotomic_pow
  • Fp2 operations

Type of change

  • Optimization

Benches

  • Actual
    Ate pairing : 1.6898 ms
    Miller loop : 540.37 µs
    Final exponentiation: 771.49 µs

  • New version
    Ate pairing :939.71 µs
    Miller loop : 375.96 µs
    Final exponentiation: 347.71 µs

@jotabulacios jotabulacios marked this pull request as ready for review August 30, 2024 19:35
@jotabulacios jotabulacios requested a review from a team as a code owner August 30, 2024 19:35
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2024

Codecov Report

Attention: Patch coverage is 91.34078% with 31 lines in your changes missing coverage. Please review.

Project coverage is 72.72%. Comparing base (8133ae5) to head (dcd29f7).

Files with missing lines Patch % Lines
...short_weierstrass/curves/bn_254/field_extension.rs 84.02% 23 Missing ⚠️
...c_curve/short_weierstrass/curves/bn_254/pairing.rs 96.26% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #899      +/-   ##
==========================================
- Coverage   72.82%   72.72%   -0.10%     
==========================================
  Files         150      150              
  Lines       34151    34498     +347     
==========================================
+ Hits        24870    25090     +220     
- Misses       9281     9408     +127     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ColoCarletti ColoCarletti left a comment

Choose a reason for hiding this comment

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

LGTM!

@jotabulacios jotabulacios added this pull request to the merge queue Sep 13, 2024
Merged via the queue into main with commit 28e2cdd Sep 13, 2024
7 checks passed
@jotabulacios jotabulacios deleted the optimize-bn254 branch September 13, 2024 14:11
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.

5 participants