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

BLS: add benchmarking for Affine form host functions #1904

Merged
merged 7 commits into from
Nov 17, 2023

Conversation

linh2931
Copy link
Member

@linh2931 linh2931 commented Nov 15, 2023

Benchmarking for Affine form host functions.

Did a comparison between Jacobian form and Affine form.

Jacobian form

function                                runs        average       minimum       maximum

bls:
bls_g1_add                              5,000       3,726 ns       3,546 ns      11,037 ns
bls_g1_add_mont                         5,000       3,423 ns       3,276 ns      11,356 ns
bls_g2_add                              5,000      10,195 ns       9,823 ns      22,700 ns
bls_g2_add_mont                         5,000       9,640 ns       9,219 ns      38,835 ns
bls_pairing 1 pair                      5,000   1,731,868 ns   1,682,579 ns   3,101,753 ns
bls_pairing_mont 1 pair                 5,000   1,736,806 ns   1,675,763 ns  12,641,838 ns
bls_pairing 3 pairs                     5,000   2,768,731 ns   2,653,448 ns   3,946,737 ns
bls_pairing_mont 3 pairs                5,000   2,757,585 ns   2,656,286 ns  16,153,583 ns
bls_g1_weighted_sum 1 point             5,000     185,576 ns     183,298 ns     207,651 ns
bls_g1_weighted_sum_mont 1 point        5,000     185,674 ns     183,339 ns     208,466 ns
bls_g1_weighted_sum 3 points            5,000     590,138 ns     579,728 ns     688,373 ns
bls_g1_weighted_sum_mont 3 points       5,000     606,476 ns     592,578 ns   8,403,153 ns
bls_g1_weighted_sum 5 points            5,000     735,405 ns     725,322 ns     845,926 ns
bls_g1_weighted_sum_mont 5 points       5,000     731,664 ns     721,941 ns     835,411 ns
bls_g2_weighted_sum 1 point             5,000     706,839 ns     685,898 ns   1,045,018 ns
bls_g2_weighted_sum_mont 1 point        5,000     743,762 ns     719,694 ns   1,011,417 ns
bls_g2_weighted_sum 3 points            5,000   2,301,903 ns   2,227,814 ns  16,066,772 ns
bls_g2_weighted_sum_mont 3 points       5,000   2,270,676 ns   2,205,879 ns   3,039,832 ns
bls_g2_weighted_sum 5 points            5,000   2,841,482 ns   2,759,238 ns  19,348,134 ns
bls_g2_weighted_sum_mont 5 points       5,000   2,829,128 ns   2,740,629 ns  14,205,987 ns
bls_g1_map                              5,000     301,257 ns     296,573 ns     442,878 ns
bls_g1_map_mont                         5,000     305,439 ns     301,122 ns     449,227 ns
bls_g2_map                              5,000     458,721 ns     448,555 ns     605,324 ns
bls_g2_map_mont                         5,000     453,444 ns     445,441 ns     602,810 ns
bls_fp_mod                              5,000         727 ns         625 ns       5,797 ns
bls_fp_mod_mont                         5,000         821 ns         687 ns       8,068 ns
bls_fp_mul                              5,000         681 ns         645 ns       4,119 ns
bls_fp_mul_mont                         5,000         588 ns         521 ns       6,536 ns
bls_fp_exp                              5,000      32,829 ns      31,899 ns      49,464 ns
bls_fp_exp_mont                         5,000      32,254 ns      31,151 ns      39,113 ns

Affine form

bls:
bls_g1_add                              5,000      76,699 ns      75,622 ns     123,329 ns
bls_g1_add_mont                         5,000      77,344 ns      75,954 ns     124,887 ns
bls_g2_add                              5,000      82,521 ns      81,196 ns     131,229 ns
bls_g2_add_mont                         5,000      82,184 ns      80,506 ns   1,454,766 ns
bls_pairing 1 pair                      5,000   1,638,763 ns   1,557,463 ns   3,569,653 ns
bls_pairing_mont 1 pair                 5,000   1,620,381 ns   1,545,184 ns   3,005,809 ns
bls_pairing 3 pairs                     5,000   2,321,344 ns   2,232,847 ns   3,740,820 ns
bls_pairing_mont 3 pairs                5,000   2,325,408 ns   2,249,310 ns   3,706,786 ns
bls_g1_weighted_sum 1 point             5,000     260,683 ns     258,196 ns     328,138 ns
bls_g1_weighted_sum_mont 1 point        5,000     256,633 ns     253,419 ns   1,086,645 ns
bls_g1_weighted_sum 3 points            5,000     670,546 ns     661,700 ns   2,038,831 ns
bls_g1_weighted_sum_mont 3 points       5,000     683,842 ns     675,641 ns   2,111,874 ns
bls_g1_weighted_sum 5 points            5,000     817,884 ns     808,866 ns   2,200,022 ns
bls_g1_weighted_sum_mont 5 points       5,000     807,745 ns     797,233 ns   2,215,336 ns
bls_g2_weighted_sum 1 point             5,000     818,862 ns     794,358 ns   2,368,434 ns
bls_g2_weighted_sum_mont 1 point        5,000     794,397 ns     770,952 ns   2,166,481 ns
bls_g2_weighted_sum 3 points            5,000   2,338,746 ns   2,285,345 ns   4,072,288 ns
bls_g2_weighted_sum_mont 3 points       5,000   2,382,895 ns   2,330,791 ns   4,336,254 ns
bls_g2_weighted_sum 5 points            5,000   2,924,081 ns   2,845,713 ns  22,833,113 ns
bls_g2_weighted_sum_mont 5 points       5,000   3,001,189 ns   2,914,939 ns  26,705,436 ns
bls_g1_map                              5,000     379,593 ns     372,223 ns     566,554 ns
bls_g1_map_mont                         5,000     375,586 ns     369,145 ns     563,225 ns
bls_g2_map                              5,000     531,899 ns     522,480 ns     722,943 ns
bls_g2_map_mont                         5,000     534,658 ns     520,874 ns     722,779 ns
bls_fp_mod                              5,000         794 ns         703 ns       9,219 ns
bls_fp_mod_mont                         5,000         862 ns         706 ns       6,692 ns
bls_fp_mul                              5,000         692 ns         621 ns       7,913 ns
bls_fp_mul_mont                         5,000         591 ns         540 ns       7,971 ns
bls_fp_exp                              5,000      32,397 ns      31,702 ns      43,478 ns
bls_fp_exp_mont                         5,000      32,535 ns      31,943 ns      44,466 ns

@linh2931 linh2931 requested review from arhag and yarkinwho November 15, 2023 01:50
@greg7mdp
Copy link
Contributor

greg7mdp commented Nov 15, 2023

Strange, it looks like providing the parameters in Montgomery form doesn't make a significant difference.

@linh2931 linh2931 changed the title BLS: add benchmarking for Montgomery form host functions BLS: add benchmarking for Affine form host functions Nov 15, 2023
benchmark/bls.cpp Show resolved Hide resolved
benchmark/bls.cpp Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
benchmark/bls.cpp Outdated Show resolved Hide resolved
@yarkinwho
Copy link
Contributor

All _mont function removed now. Benchmarks for them should be removed.

@linh2931
Copy link
Member Author

All _mont function removed now. Benchmarks for them should be removed.

Thanks for the reminder. Removed.

@linh2931 linh2931 merged commit cc9bba8 into yarkin/update_bls Nov 17, 2023
29 checks passed
@linh2931 linh2931 deleted the more_bls_benchmark branch November 17, 2023 00:09
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.

4 participants