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

perf: BW6 pairing computation using non-native Eval #1312

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

ivokub
Copy link
Collaborator

@ivokub ivokub commented Nov 5, 2024

Description

This PR refactors the methods in the fields_bw6761 package to use the Field.Eval methods introduced in #1299. Depends on it being merged first.

Currently we use simple schoolbook multiplication formulas, but can have better performance with specialized formulas a la Toom-Cook etc. Currently didn't find a good way to give a multivariate representation to them.

Type of change

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

How has this been tested?

  • TestSquareVariantsFp6
  • TestMulVariantsFp6
  • TestFp6Mul023By023Variants
  • TestFp6MulBy02345Variants
  • TestFp6CyclotomicSquareKarabina12345Variants

How has this been benchmarked?

  • Single Miller loop before: 6500708, now: 3841000
  • Single Miller loop fixed G2 before: 5344302, now: 2680076
  • FinalExp before: 5245872, now: 3362746
  • Full pairing before: 11486969, now: 6947630
  • Full pairing fixed G2 before: 10440385, now: 5888826

But keep in mind that I only measured single operations so they include range checks for the initial witness.

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

@ivokub ivokub marked this pull request as ready for review November 22, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant