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

Improve G2 deserialization performance in arkworks #58

Open
ggkitsas opened this issue Aug 4, 2021 · 4 comments
Open

Improve G2 deserialization performance in arkworks #58

ggkitsas opened this issue Aug 4, 2021 · 4 comments
Assignees

Comments

@ggkitsas
Copy link
Contributor

ggkitsas commented Aug 4, 2021

No description provided.

@simonmasson simonmasson self-assigned this Aug 5, 2021
@simonmasson
Copy link

simonmasson commented Aug 5, 2021

The deserialization in arkworks is currently very slow because of the subgroup check:

test bls12_381::g1::deser           ... bench:     190,636 ns/iter (+/- 3,634)
test bls12_381::g2::deser           ... bench:     630,359 ns/iter (+/- 4,483)

Using the technique of eprint 2019/814 would lead to a more efficient subgroup check and hence a more efficient deserialization.
Roughly, G2 subgroup check can be ~3.5-4 times faster, and G1 subgroup check can be ~1.5-2 times faster.
I am currently working on this.

@simonmasson
Copy link

simonmasson commented Aug 12, 2021

I implemented the fast subgroup for both G1 and G2, and here are the results:

  • With the naive subgroup check:
test bls12_381::g1::deser           ... bench:     222,111 ns/iter (+/- 57,015)
test bls12_381::g2::deser           ... bench:     646,068 ns/iter (+/- 71,398)
  • With the fast subgroup check:
test bls12_381::g1::deser           ... bench:     129,490 ns/iter (+/- 4,764)
test bls12_381::g2::deser           ... bench:     192,589 ns/iter (+/- 55,601)

@simonmasson
Copy link

Benchmarks can be reproducible in the heliaxdev/curves repository, branch simon/fast-subgroup-checks.

cd /tmp
git clone [email protected]:heliaxdev/curves.git
cd curves/curve-benches/
git checkout simon/fast-subgroup-checks
cargo bench -- bls12_381 --exact

Next step is to benchmark the functions of Ferveo. It will be done in the branch simon/fast-subgroup-checks of Ferveo.

@simonmasson
Copy link

The subgroup check has been added to arkworks-rs/{algebra, curves}. Maybe the square root algorithm can be computed faster (?).

@ghost ghost added the prio:high label Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants