Crypto/bls12_381: optimize public key and signature aggregation
This MR optimizes public key and signature aggregation functions by using blst_p1s_add/blst_p2s_add from the blst library.
Manually testing the MR
dune runtest in src/lib_bls12_381_signature/test and src/lib_bls12_381/test
Benchmarks
dune build src/bin_test/test.exe && PROFILING="*->info" dune exec src/bin_test/test.exe && cat /tmp/test.txt on this branch.
Benchmarks on Dell XPS 13 with Intel Core Ultra 7 258V processor:
Number of public keys = 200
- Aggregate signatures
aggregate all 200 signatures (master) ........................................ 1 11.584ms 100%
aggregate signatures (in C, with check) ...................................... 1 11.420ms 101%
aggregate signatures (in C, no check) ........................................ 1 4.434ms 100%
- Aggregate public keys
aggregate all 200 pks (add_bulk) ............................................. 1 8.423ms 100%
aggregate all 200 pks (add_bulk, no check) ................................... 1 2.243ms 100%
aggregate all 200 pks (in C, with check) ..................................... 1 8.302ms 100%
aggregate all 200 pks (in C, no check) ....................................... 1 2.193ms 101%
Number of public keys = 20_000
- Aggregate signatures
aggregate all 20000 signatures (master) ...................................... 1 1157.355ms 100%
aggregate signatures (in C, with check) ...................................... 1 1143.181ms 100%
aggregate signatures (in C, no check) ........................................ 1 443.468ms 100%
- Aggregate public keys
aggregate all 20000 pks (add_bulk) ........................................... 1 838.745ms 100%
aggregate all 20000 pks (add_bulk, no check) ................................. 1 225.276ms 100%
aggregate all 20000 pks (in C, with check) ................................... 1 831.541ms 100%
aggregate all 20000 pks (in C, no check) ..................................... 1 219.350ms 100%
Checklist
-
Document the interface of any function added or modified (see the coding guidelines) -
Document any change to the user interface, including configuration parameters (see node configuration) -
Provide automatic testing (see the testing guide). -
For new features and bug fixes, add an item in the appropriate changelog ( docs/protocols/alpha.rstfor the protocol and the environment,CHANGES.rstat the root of the repository for everything else). -
Select suitable reviewers using the Reviewersfield below. -
Select as Assigneethe next person who should take action on that MR
Edited by Marina Polubelova