From 363426c1d41aa89c8e64bc4fd265b7cefe24fb03 Mon Sep 17 00:00:00 2001 From: Pratyush Mishra Date: Fri, 9 Sep 2022 19:24:33 -0700 Subject: [PATCH] Update to new benchmarking framework (#126) --- .github/workflows/ci.yml | 5 +- Cargo.toml | 5 +- bls12_377/Cargo.toml | 8 +- bls12_377/benches/bls12_377.rs | 16 +++ bls12_381/Cargo.toml | 6 ++ bls12_381/benches/bls12_381.rs | 16 +++ bn254/Cargo.toml | 6 ++ bn254/benches/bn254.rs | 13 +++ bw6_761/Cargo.toml | 6 ++ bw6_761/benches/bw6_761.rs | 16 +++ cp6_782/Cargo.toml | 6 ++ cp6_782/benches/cp6_782.rs | 15 +++ curve-benches/Cargo.toml | 115 --------------------- curve-benches/LICENSE-APACHE | 1 - curve-benches/LICENSE-MIT | 1 - curve-benches/benches/bls12_377.rs | 31 ------ curve-benches/benches/bls12_381.rs | 31 ------ curve-benches/benches/bn254.rs | 30 ------ curve-benches/benches/bw6_761.rs | 32 ------ curve-benches/benches/cp6_782.rs | 29 ------ curve-benches/benches/ed_on_bls12_381.rs | 16 --- curve-benches/benches/mnt4_298.rs | 29 ------ curve-benches/benches/mnt4_753.rs | 29 ------ curve-benches/benches/mnt6_298.rs | 29 ------ curve-benches/benches/mnt6_753.rs | 29 ------ curve-benches/benches/pallas.rs | 16 --- curve-benches/benches/vesta.rs | 16 --- ed_on_bls12_381/Cargo.toml | 1 + ed_on_bls12_381/benches/ed_on_bls12_381.rs | 9 ++ mnt4_298/Cargo.toml | 8 +- mnt4_298/benches/mnt4_298.rs | 15 +++ mnt4_753/Cargo.toml | 8 +- mnt4_753/benches/mnt4_753.rs | 15 +++ mnt6_298/Cargo.toml | 10 +- mnt6_298/benches/mnt6_298.rs | 15 +++ mnt6_753/Cargo.toml | 8 +- mnt6_753/benches/mnt6_753.rs | 15 +++ pallas/Cargo.toml | 8 +- pallas/benches/pallas.rs | 9 ++ rustfmt.toml | 2 +- vesta/Cargo.toml | 8 +- vesta/benches/vesta.rs | 9 ++ 42 files changed, 244 insertions(+), 448 deletions(-) create mode 100644 bls12_377/benches/bls12_377.rs create mode 100644 bls12_381/benches/bls12_381.rs create mode 100644 bn254/benches/bn254.rs create mode 100644 bw6_761/benches/bw6_761.rs create mode 100644 cp6_782/benches/cp6_782.rs delete mode 100644 curve-benches/Cargo.toml delete mode 120000 curve-benches/LICENSE-APACHE delete mode 120000 curve-benches/LICENSE-MIT delete mode 100644 curve-benches/benches/bls12_377.rs delete mode 100644 curve-benches/benches/bls12_381.rs delete mode 100644 curve-benches/benches/bn254.rs delete mode 100644 curve-benches/benches/bw6_761.rs delete mode 100644 curve-benches/benches/cp6_782.rs delete mode 100644 curve-benches/benches/ed_on_bls12_381.rs delete mode 100644 curve-benches/benches/mnt4_298.rs delete mode 100644 curve-benches/benches/mnt4_753.rs delete mode 100644 curve-benches/benches/mnt6_298.rs delete mode 100644 curve-benches/benches/mnt6_753.rs delete mode 100644 curve-benches/benches/pallas.rs delete mode 100644 curve-benches/benches/vesta.rs create mode 100644 ed_on_bls12_381/benches/ed_on_bls12_381.rs create mode 100644 mnt4_298/benches/mnt4_298.rs create mode 100644 mnt4_753/benches/mnt4_753.rs create mode 100644 mnt6_298/benches/mnt6_298.rs create mode 100644 mnt6_753/benches/mnt6_753.rs create mode 100644 pallas/benches/pallas.rs create mode 100644 vesta/benches/vesta.rs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe06a7d..90256b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,7 +103,6 @@ jobs: exclude: - dir: scripts/ - dir: curve-constraint-tests/ - - dir: curve-benches/ steps: - name: Checkout uses: actions/checkout@v2 @@ -159,10 +158,10 @@ jobs: uses: actions-rs/cargo@v1 with: command: check - args: --examples --workspace --exclude ark-curve-constraint-tests --exclude ark-curve-benches --target aarch64-unknown-none + args: --examples --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none - name: build uses: actions-rs/cargo@v1 with: command: build - args: --workspace --exclude ark-curve-constraint-tests --exclude ark-curve-benches --target aarch64-unknown-none + args: --workspace --exclude ark-curve-constraint-tests --target aarch64-unknown-none diff --git a/Cargo.toml b/Cargo.toml index 8a2ec70..a77f301 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,6 @@ [workspace] members = [ - "curve-benches", "curve-constraint-tests", "bls12_377", @@ -31,6 +30,7 @@ members = [ "pallas", "vesta", ] +resolver = "2" [profile.release] opt-level = 3 @@ -64,5 +64,6 @@ ark-ff = { git = "https://github.com/arkworks-rs/algebra" } ark-serialize = { git = "https://github.com/arkworks-rs/algebra" } ark-algebra-bench-templates = { git = "https://github.com/arkworks-rs/algebra" } ark-algebra-test-templates = { git = "https://github.com/arkworks-rs/algebra" } + ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std" } -ark-std = { git = "https://github.com/arkworks-rs/std" } \ No newline at end of file +ark-std = { git = "https://github.com/arkworks-rs/std" } diff --git a/bls12_377/Cargo.toml b/bls12_377/Cargo.toml index 76b737d..670c7f4 100644 --- a/bls12_377/Cargo.toml +++ b/bls12_377/Cargo.toml @@ -22,6 +22,7 @@ ark-std = { version="^0.3.0", default-features = false } ark-relations = { version="^0.3.0", default-features = false } ark-serialize = { version="^0.3.0", default-features = false } ark-algebra-test-templates = { version="^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] @@ -31,4 +32,9 @@ std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] curve = [ "scalar_field", "base_field" ] scalar_field = [] base_field = [] -r1cs = [ "base_field", "ark-r1cs-std" ] \ No newline at end of file +r1cs = [ "base_field", "ark-r1cs-std" ] + +[[bench]] +name = "bls12_377" +path = "benches/bls12_377.rs" +harness = false diff --git a/bls12_377/benches/bls12_377.rs b/bls12_377/benches/bls12_377.rs new file mode 100644 index 0000000..7bb18ab --- /dev/null +++ b/bls12_377/benches/bls12_377.rs @@ -0,0 +1,16 @@ +use ark_algebra_bench_templates::*; + +use ark_bls12_377::{ + fq::Fq, fq2::Fq2, fr::Fr, Bls12_377, Fq12, G1Projective as G1, G2Projective as G2, +}; + +bench!( + Name = "Bls12_377", + Pairing = Bls12_377, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq2, + TargetField = Fq12, +); diff --git a/bls12_381/Cargo.toml b/bls12_381/Cargo.toml index da69275..96f20cd 100644 --- a/bls12_381/Cargo.toml +++ b/bls12_381/Cargo.toml @@ -20,6 +20,7 @@ ark-std = { version="^0.3.0", default-features = false } [dev-dependencies] ark-serialize = { version="^0.3.0", default-features = false } ark-algebra-test-templates = { version="^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } [features] default = [ "curve" ] @@ -27,3 +28,8 @@ std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] curve = [ "scalar_field" ] scalar_field = [] + +[[bench]] +name = "bls12_381" +path = "benches/bls12_381.rs" +harness = false diff --git a/bls12_381/benches/bls12_381.rs b/bls12_381/benches/bls12_381.rs new file mode 100644 index 0000000..ac9d6ff --- /dev/null +++ b/bls12_381/benches/bls12_381.rs @@ -0,0 +1,16 @@ +use ark_algebra_bench_templates::*; + +use ark_bls12_381::{ + fq::Fq, fq2::Fq2, fr::Fr, Bls12_381, Fq12, G1Projective as G1, G2Projective as G2, +}; + +bench!( + Name = "Bls12_381", + Pairing = Bls12_381, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq2, + TargetField = Fq12, +); diff --git a/bn254/Cargo.toml b/bn254/Cargo.toml index d1450a8..a5cd96b 100644 --- a/bn254/Cargo.toml +++ b/bn254/Cargo.toml @@ -20,6 +20,7 @@ ark-std = { version="^0.3.0", default-features = false } [dev-dependencies] ark-serialize = { version="^0.3.0", default-features = false } ark-algebra-test-templates = { version="^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } [features] default = [ "curve" ] @@ -27,3 +28,8 @@ std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] curve = [ "scalar_field" ] scalar_field = [] + +[[bench]] +name = "bn254" +path = "benches/bn254.rs" +harness = false diff --git a/bn254/benches/bn254.rs b/bn254/benches/bn254.rs new file mode 100644 index 0000000..08cf392 --- /dev/null +++ b/bn254/benches/bn254.rs @@ -0,0 +1,13 @@ +use ark_algebra_bench_templates::*; +use ark_bn254::{fq::Fq, fq2::Fq2, fr::Fr, Bn254, Fq12, G1Projective as G1, G2Projective as G2}; + +bench!( + Name = "BN254", + Pairing = Bn254, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq2, + TargetField = Fq12, +); diff --git a/bw6_761/Cargo.toml b/bw6_761/Cargo.toml index f442370..50ef8ea 100644 --- a/bw6_761/Cargo.toml +++ b/bw6_761/Cargo.toml @@ -21,7 +21,13 @@ ark-bls12-377 = { version="^0.3.0", path = "../bls12_377", default-features = fa [dev-dependencies] ark-serialize = { version="^0.3.0", default-features = false } ark-algebra-test-templates = { version="^0.3.0", default-features = false } +ark-algebra-bench-templates = { version="^0.3.0", default-features = false } [features] default = [] std = [ "ark-std/std", "ark-ff/std", "ark-ec/std", "ark-bls12-377/std" ] + +[[bench]] +name = "bw6_761" +path = "benches/bw6_761.rs" +harness = false diff --git a/bw6_761/benches/bw6_761.rs b/bw6_761/benches/bw6_761.rs new file mode 100644 index 0000000..d7849ca --- /dev/null +++ b/bw6_761/benches/bw6_761.rs @@ -0,0 +1,16 @@ +use ark_algebra_bench_templates::*; + +use ark_bw6_761::{ + fq::Fq, fq3::Fq3, fq6::Fq6, fr::Fr, g1::G1Projective as G1, g2::G2Projective as G2, BW6_761, +}; + +bench!( + Name = "BW6_761", + Pairing = BW6_761, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq3, + TargetField = Fq6, +); diff --git a/cp6_782/Cargo.toml b/cp6_782/Cargo.toml index 1948d39..768f1e6 100644 --- a/cp6_782/Cargo.toml +++ b/cp6_782/Cargo.toml @@ -22,7 +22,13 @@ ark-serialize = { version = "^0.3.0", default-features = false } [dev-dependencies] ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version="^0.3.0", default-features = false } [features] default = [] std = [ "ark-std/std", "ark-ff/std", "ark-ec/std", "ark-bls12-377/std" ] + +[[bench]] +name = "cp6_782" +path = "benches/cp6_782.rs" +harness = false diff --git a/cp6_782/benches/cp6_782.rs b/cp6_782/benches/cp6_782.rs new file mode 100644 index 0000000..75670e9 --- /dev/null +++ b/cp6_782/benches/cp6_782.rs @@ -0,0 +1,15 @@ +use ark_algebra_bench_templates::*; +use ark_cp6_782::{ + fq::Fq, fq3::Fq3, fq6::Fq6, fr::Fr, g1::G1Projective as G1, g2::G2Projective as G2, CP6_782, +}; + +bench!( + Name = "CP6_782", + Pairing = CP6_782, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq3, + TargetField = Fq6, +); diff --git a/curve-benches/Cargo.toml b/curve-benches/Cargo.toml deleted file mode 100644 index 2b17fc0..0000000 --- a/curve-benches/Cargo.toml +++ /dev/null @@ -1,115 +0,0 @@ -[package] -name = "ark-curve-benches" -version = "0.3.0" -authors = [ - "Sean Bowe", - "Alessandro Chiesa", - "Matthew Green", - "Ian Miers", - "Pratyush Mishra", - "Howard Wu", - "Daira Hopwood" -] -description = "A benchmark library for finite fields and elliptic curves" -homepage = "https://arkworks.rs" -repository = "https://github.com/arkworks-rs/curves" -documentation = "https://docs.rs/algebra/" -keywords = ["cryptography", "finite-fields", "elliptic-curves", "pairing"] -categories = ["cryptography"] -include = ["Cargo.toml", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] -license = "MIT/Apache-2.0" -edition = "2021" -publish = false - -################################# Dependencies ################################ - -[dependencies] -bencher = { version = "0.1.5" } - -[dev-dependencies] -ark-std = { version = "^0.3.0", default-features = false } -ark-ec = { version = "^0.3.0", default-features = false } -ark-ff = { version = "^0.3.0", default-features = false } -ark-serialize = { version = "^0.3.0", default-features = false } -ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } - -ark-mnt4-298 = { path = "../mnt4_298" } -ark-mnt6-298 = { path = "../mnt6_298" } -ark-mnt4-753 = { path = "../mnt4_753" } -ark-mnt6-753 = { path = "../mnt6_753" } -ark-bn254 = { path = "../bn254" } -ark-bls12-377 = { path = "../bls12_377" } -ark-bls12-381 = { path = "../bls12_381" } -ark-ed-on-bls12-381 = { path = "../ed_on_bls12_381" } -ark-bw6-761 = { path = "../bw6_761" } -ark-cp6-782 = { path = "../cp6_782" } -ark-pallas = { path = "../pallas" } -ark-vesta = { path = "../vesta" } - -[features] -asm = [ "ark-ff/asm"] -parallel = [ "ark-ff/parallel", "ark-ec/parallel" ] -n_fold = [] - -[build-dependencies] -rustc_version = "0.2" - -[[bench]] -name = "bls12_377" -path = "benches/bls12_377.rs" -harness = false - -[[bench]] -name = "bls12_381" -path = "benches/bls12_381.rs" -harness = false - -[[bench]] -name = "bn254" -path = "benches/bn254.rs" -harness = false - -[[bench]] -name = "bw6_761" -path = "benches/bw6_761.rs" -harness = false - -[[bench]] -name = "cp6_782" -path = "benches/cp6_782.rs" -harness = false - -[[bench]] -name = "ed_on_bls12_381" -path = "benches/ed_on_bls12_381.rs" -harness = false - -[[bench]] -name = "mnt4_298" -path = "benches/mnt4_298.rs" -harness = false - -[[bench]] -name = "mnt6_298" -path = "benches/mnt6_298.rs" -harness = false - -[[bench]] -name = "mnt4_753" -path = "benches/mnt4_753.rs" -harness = false - -[[bench]] -name = "mnt6_753" -path = "benches/mnt6_753.rs" -harness = false - -[[bench]] -name = "pallas" -path = "benches/pallas.rs" -harness = false - -[[bench]] -name = "vesta" -path = "benches/vesta.rs" -harness = false diff --git a/curve-benches/LICENSE-APACHE b/curve-benches/LICENSE-APACHE deleted file mode 120000 index 965b606..0000000 --- a/curve-benches/LICENSE-APACHE +++ /dev/null @@ -1 +0,0 @@ -../LICENSE-APACHE \ No newline at end of file diff --git a/curve-benches/LICENSE-MIT b/curve-benches/LICENSE-MIT deleted file mode 120000 index 76219eb..0000000 --- a/curve-benches/LICENSE-MIT +++ /dev/null @@ -1 +0,0 @@ -../LICENSE-MIT \ No newline at end of file diff --git a/curve-benches/benches/bls12_377.rs b/curve-benches/benches/bls12_377.rs deleted file mode 100644 index c75574b..0000000 --- a/curve-benches/benches/bls12_377.rs +++ /dev/null @@ -1,31 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_bls12_377::{ - fq::Fq, fq2::Fq2, fr::Fr, Bls12_377, Fq12, G1Affine, G1Projective as G1, G2Affine, - G2Projective as G2, -}; -use ark_ec::bls12::{G1Prepared, G2Prepared}; -use ark_ec::{CurveGroup, Group}; -use ark_ff::{ - biginteger::{BigInteger256 as FrRepr, BigInteger384 as FqRepr}, - BigInteger, Field, PrimeField, UniformRand, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FrRepr, FrRepr, fr); -f_bench!(extension, Fq2, Fq2, fq2); -f_bench!(target, Fq12, Fq12, fq12); - -pairing_bench!(Bls12_377, Fq12); - -bencher::benchmark_main!(fq, fr, fq2, fq12, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/bls12_381.rs b/curve-benches/benches/bls12_381.rs deleted file mode 100644 index 47f3b19..0000000 --- a/curve-benches/benches/bls12_381.rs +++ /dev/null @@ -1,31 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_bls12_381::{ - fq::Fq, fq2::Fq2, fr::Fr, Bls12_381, Fq12, G1Affine, G1Projective as G1, G2Affine, - G2Projective as G2, -}; -use ark_ec::bls12::{G1Prepared, G2Prepared}; -use ark_ec::{CurveGroup, Group}; -use ark_ff::{ - biginteger::{BigInteger256 as FrRepr, BigInteger384 as FqRepr}, - BigInteger, Field, PrimeField, UniformRand, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FrRepr, FrRepr, fr); -f_bench!(extension, Fq2, Fq2, fq2); -f_bench!(target, Fq12, Fq12, fq12); - -pairing_bench!(Bls12_381, Fq12); - -bencher::benchmark_main!(fq, fr, fq2, fq12, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/bn254.rs b/curve-benches/benches/bn254.rs deleted file mode 100644 index cbab93c..0000000 --- a/curve-benches/benches/bn254.rs +++ /dev/null @@ -1,30 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_bn254::{ - fq::Fq, fq2::Fq2, fr::Fr, Bn254, Fq12, G1Affine, G1Projective as G1, G2Affine, - G2Projective as G2, -}; -use ark_ec::{ - bn::{G1Prepared, G2Prepared}, - CurveGroup, Group, -}; -use ark_ff::{biginteger::BigInteger256 as Repr, BigInteger, Field, PrimeField, UniformRand}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(Fq, Fq, Repr, Repr, fq); -f_bench!(Fr, Fr, Repr, Repr, fr); -f_bench!(extension, Fq2, Fq2, fq2); -f_bench!(target, Fq12, Fq12, fq12); - -pairing_bench!(Bn254, Fq12); - -bencher::benchmark_main!(fq, fr, fq2, fq12, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/bw6_761.rs b/curve-benches/benches/bw6_761.rs deleted file mode 100644 index fe2ed52..0000000 --- a/curve-benches/benches/bw6_761.rs +++ /dev/null @@ -1,32 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_bw6_761::{ - fq::Fq, fq3::Fq3, fr::Fr, Fq6, G1Affine, G1Projective as G1, G2Affine, G2Projective as G2, - BW6_761, -}; -use ark_ec::{ - bw6::{G1Prepared, G2Prepared}, - CurveGroup, Group, -}; -use ark_ff::{ - biginteger::{BigInteger384 as FrRepr, BigInteger768 as FqRepr}, - BigInteger, Field, PrimeField, UniformRand, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(extension, Fq3, Fq3, fq3); -f_bench!(target, Fq6, Fq6, fq6); -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FrRepr, FrRepr, fr); -pairing_bench!(BW6_761, Fq6); - -bencher::benchmark_main!(fq, fr, fq3, fq6, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/cp6_782.rs b/curve-benches/benches/cp6_782.rs deleted file mode 100644 index e733639..0000000 --- a/curve-benches/benches/cp6_782.rs +++ /dev/null @@ -1,29 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_cp6_782::{ - fq::Fq, fq3::Fq3, fr::Fr, Fq6, G1Affine, G1Prepared, G1Projective as G1, G2Affine, G2Prepared, - G2Projective as G2, CP6_782, -}; -use ark_ec::{CurveGroup, Group}; -use ark_ff::{ - biginteger::{BigInteger384 as FrRepr, BigInteger832 as FqRepr}, - BigInteger, Field, PrimeField, UniformRand, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(extension, Fq3, Fq3, fq3); -f_bench!(target, Fq6, Fq6, fq6); -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FrRepr, FrRepr, fr); -pairing_bench!(CP6_782, Fq6); - -bencher::benchmark_main!(fq, fr, fq3, fq6, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/ed_on_bls12_381.rs b/curve-benches/benches/ed_on_bls12_381.rs deleted file mode 100644 index 0e1555f..0000000 --- a/curve-benches/benches/ed_on_bls12_381.rs +++ /dev/null @@ -1,16 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{CurveGroup, Group}; -use ark_ed_on_bls12_381::{fq::Fq, fr::Fr, EdwardsAffine as GAffine, EdwardsProjective as G}; -use ark_ff::{biginteger::BigInteger256 as Repr, BigInteger, Field, PrimeField, UniformRand}; - -mod g { - use super::*; - ec_bench!(G, GAffine); -} - -f_bench!(Fq, Fq, Repr, Repr, fq); -f_bench!(Fr, Fr, Repr, Repr, fr); - -bencher::benchmark_main!(fq, fr, g::group_ops); diff --git a/curve-benches/benches/mnt4_298.rs b/curve-benches/benches/mnt4_298.rs deleted file mode 100644 index 5ff031e..0000000 --- a/curve-benches/benches/mnt4_298.rs +++ /dev/null @@ -1,29 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{ - mnt4::{G1Prepared, G2Prepared}, - CurveGroup, Group, -}; -use ark_ff::{biginteger::BigInteger320 as FqRepr, BigInteger, Field, PrimeField, UniformRand}; -use ark_mnt4_298::{ - fq::Fq, fq2::Fq2, fr::Fr, Fq4, G1Affine, G1Projective as G1, G2Affine, G2Projective as G2, - MNT4_298, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(extension, Fq2, Fq2, fq2); -f_bench!(target, Fq4, Fq4, fq4); -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FqRepr, FqRepr, fr); -pairing_bench!(MNT4_298, Fq4); - -bencher::benchmark_main!(fq, fr, fq2, fq4, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/mnt4_753.rs b/curve-benches/benches/mnt4_753.rs deleted file mode 100644 index 468d7b6..0000000 --- a/curve-benches/benches/mnt4_753.rs +++ /dev/null @@ -1,29 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{ - mnt4::{G1Prepared, G2Prepared}, - CurveGroup, Group, -}; -use ark_ff::{biginteger::BigInteger768 as FqRepr, BigInteger, Field, PrimeField, UniformRand}; -use ark_mnt4_753::{ - fq::Fq, fq2::Fq2, fr::Fr, Fq4, G1Affine, G1Projective as G1, G2Affine, G2Projective as G2, - MNT4_753, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(extension, Fq2, Fq2, fq2); -f_bench!(target, Fq4, Fq4, fq4); -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FqRepr, FqRepr, fr); -pairing_bench!(MNT4_753, Fq4); - -bencher::benchmark_main!(fq, fr, fq2, fq4, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/mnt6_298.rs b/curve-benches/benches/mnt6_298.rs deleted file mode 100644 index 629ed6b..0000000 --- a/curve-benches/benches/mnt6_298.rs +++ /dev/null @@ -1,29 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{ - mnt6::{G1Prepared, G2Prepared}, - CurveGroup, Group, -}; -use ark_ff::{biginteger::BigInteger320 as FqRepr, BigInteger, Field, PrimeField, UniformRand}; -use ark_mnt6_298::{ - fq::Fq, fq3::Fq3, fr::Fr, Fq6, G1Affine, G1Projective as G1, G2Affine, G2Projective as G2, - MNT6_298, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(extension, Fq3, Fq3, fq3); -f_bench!(target, Fq6, Fq6, fq6); -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FqRepr, FqRepr, fr); -pairing_bench!(MNT6_298, Fq6); - -bencher::benchmark_main!(fq, fr, fq3, fq6, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/mnt6_753.rs b/curve-benches/benches/mnt6_753.rs deleted file mode 100644 index 1ea318f..0000000 --- a/curve-benches/benches/mnt6_753.rs +++ /dev/null @@ -1,29 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{ - mnt6::{G1Prepared, G2Prepared}, - CurveGroup, Group, -}; -use ark_ff::{biginteger::BigInteger768 as FqRepr, BigInteger, Field, PrimeField, UniformRand}; -use ark_mnt6_753::{ - fq::Fq, fq3::Fq3, fr::Fr, Fq6, G1Affine, G1Projective as G1, G2Affine, G2Projective as G2, - MNT6_753, -}; - -mod g1 { - use super::*; - ec_bench!(G1, G1Affine); -} -mod g2 { - use super::*; - ec_bench!(G2, G2Affine); -} - -f_bench!(extension, Fq3, Fq3, fq3); -f_bench!(target, Fq6, Fq6, fq6); -f_bench!(Fq, Fq, FqRepr, FqRepr, fq); -f_bench!(Fr, Fr, FqRepr, FqRepr, fr); -pairing_bench!(MNT6_753, Fq6); - -bencher::benchmark_main!(fq, fr, fq3, fq6, g1::group_ops, g2::group_ops, pairing); diff --git a/curve-benches/benches/pallas.rs b/curve-benches/benches/pallas.rs deleted file mode 100644 index 043f86f..0000000 --- a/curve-benches/benches/pallas.rs +++ /dev/null @@ -1,16 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{CurveGroup, Group}; -use ark_ff::{biginteger::BigInteger256 as Repr, BigInteger, Field, PrimeField, UniformRand}; -use ark_pallas::{fq::Fq, fr::Fr, Affine as GAffine, Projective as G}; - -mod g { - use super::*; - ec_bench!(G, GAffine); -} - -f_bench!(Fq, Fq, Repr, Repr, fq); -f_bench!(Fr, Fr, Repr, Repr, fr); - -bencher::benchmark_main!(fq, fr, g::group_ops); diff --git a/curve-benches/benches/vesta.rs b/curve-benches/benches/vesta.rs deleted file mode 100644 index b6cc6c0..0000000 --- a/curve-benches/benches/vesta.rs +++ /dev/null @@ -1,16 +0,0 @@ -use ark_algebra_bench_templates::*; -use ark_std::ops::{AddAssign, MulAssign, SubAssign}; - -use ark_ec::{CurveGroup, Group}; -use ark_ff::{biginteger::BigInteger256 as Repr, BigInteger, Field, PrimeField, UniformRand}; -use ark_vesta::{fq::Fq, fr::Fr, Affine as GAffine, Projective as G}; - -mod g { - use super::*; - ec_bench!(G, GAffine); -} - -f_bench!(Fq, Fq, Repr, Repr, fq); -f_bench!(Fr, Fr, Repr, Repr, fr); - -bencher::benchmark_main!(fq, fr, g::group_ops); diff --git a/ed_on_bls12_381/Cargo.toml b/ed_on_bls12_381/Cargo.toml index d88b956..9507710 100644 --- a/ed_on_bls12_381/Cargo.toml +++ b/ed_on_bls12_381/Cargo.toml @@ -23,6 +23,7 @@ ark-bls12-381 = { version = "^0.3.0", path = "../bls12_381", default-features = ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] diff --git a/ed_on_bls12_381/benches/ed_on_bls12_381.rs b/ed_on_bls12_381/benches/ed_on_bls12_381.rs new file mode 100644 index 0000000..c64c370 --- /dev/null +++ b/ed_on_bls12_381/benches/ed_on_bls12_381.rs @@ -0,0 +1,9 @@ +use ark_algebra_bench_templates::*; +use ark_ed_on_bls12_381::{fq::Fq, fr::Fr, EdwardsProjective as G}; + +bench!( + Name = "EdOnBls12_381", + Group = G, + ScalarField = Fr, + PrimeBaseField = Fq, +); diff --git a/mnt4_298/Cargo.toml b/mnt4_298/Cargo.toml index 054b0d6..7cb127d 100644 --- a/mnt4_298/Cargo.toml +++ b/mnt4_298/Cargo.toml @@ -22,6 +22,7 @@ ark-r1cs-std = { version = "^0.3.0", default-features = false, optional = true } ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] @@ -31,4 +32,9 @@ std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] curve = [ "scalar_field", "base_field" ] scalar_field = [] base_field = [] -r1cs = [ "base_field", "ark-r1cs-std" ] \ No newline at end of file +r1cs = [ "base_field", "ark-r1cs-std" ] + +[[bench]] +name = "mnt4_298" +path = "benches/mnt4_298.rs" +harness = false diff --git a/mnt4_298/benches/mnt4_298.rs b/mnt4_298/benches/mnt4_298.rs new file mode 100644 index 0000000..2410171 --- /dev/null +++ b/mnt4_298/benches/mnt4_298.rs @@ -0,0 +1,15 @@ +use ark_algebra_bench_templates::*; +use ark_mnt4_298::{ + fq::Fq, fq2::Fq2, fr::Fr, Fq4, G1Projective as G1, G2Projective as G2, MNT4_298, +}; + +bench!( + Name = "MNT4_298", + Pairing = MNT4_298, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq2, + TargetField = Fq4, +); diff --git a/mnt4_753/Cargo.toml b/mnt4_753/Cargo.toml index f327e57..c12052c 100644 --- a/mnt4_753/Cargo.toml +++ b/mnt4_753/Cargo.toml @@ -22,6 +22,7 @@ ark-r1cs-std = { version = "^0.3.0", default-features = false, optional = true } ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] @@ -31,4 +32,9 @@ std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] curve = [ "scalar_field", "base_field" ] scalar_field = [] base_field = [] -r1cs = [ "base_field", "ark-r1cs-std" ] \ No newline at end of file +r1cs = [ "base_field", "ark-r1cs-std" ] + +[[bench]] +name = "mnt4_753" +path = "benches/mnt4_753.rs" +harness = false diff --git a/mnt4_753/benches/mnt4_753.rs b/mnt4_753/benches/mnt4_753.rs new file mode 100644 index 0000000..f1a8c5e --- /dev/null +++ b/mnt4_753/benches/mnt4_753.rs @@ -0,0 +1,15 @@ +use ark_algebra_bench_templates::*; +use ark_mnt4_753::{ + fq::Fq, fq2::Fq2, fr::Fr, Fq4, G1Projective as G1, G2Projective as G2, MNT4_753, +}; + +bench!( + Name = "MNT4_753", + Pairing = MNT4_753, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq2, + TargetField = Fq4, +); diff --git a/mnt6_298/Cargo.toml b/mnt6_298/Cargo.toml index 892975c..f0bcd96 100644 --- a/mnt6_298/Cargo.toml +++ b/mnt6_298/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["cryptography", "finite-fields", "elliptic-curves"] categories = ["cryptography"] include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] license = "MIT/Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] ark-ff = { version = "^0.3.0", default-features = false } @@ -23,9 +23,15 @@ ark-mnt4-298 = { version = "^0.3.0", path = "../mnt4_298", default-features = fa ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] default = [] std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] -r1cs = [ "ark-r1cs-std" ] \ No newline at end of file +r1cs = [ "ark-r1cs-std" ] + +[[bench]] +name = "mnt6_298" +path = "benches/mnt6_298.rs" +harness = false diff --git a/mnt6_298/benches/mnt6_298.rs b/mnt6_298/benches/mnt6_298.rs new file mode 100644 index 0000000..7eef477 --- /dev/null +++ b/mnt6_298/benches/mnt6_298.rs @@ -0,0 +1,15 @@ +use ark_algebra_bench_templates::*; +use ark_mnt6_298::{ + fq::Fq, fq3::Fq3, fr::Fr, Fq6, G1Projective as G1, G2Projective as G2, MNT6_298, +}; + +bench!( + Name = "MNT6_298", + Pairing = MNT6_298, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq3, + TargetField = Fq6, +); diff --git a/mnt6_753/Cargo.toml b/mnt6_753/Cargo.toml index 143bd4f..fec1a86 100644 --- a/mnt6_753/Cargo.toml +++ b/mnt6_753/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["cryptography", "finite-fields", "elliptic-curves" ] categories = ["cryptography"] include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] license = "MIT/Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] ark-ff = { version = "^0.3.0", default-features = false } @@ -23,9 +23,15 @@ ark-mnt4-753 = { version = "^0.3.0", path = "../mnt4_753", default-features = fa ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] default = [] std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] r1cs = ["ark-r1cs-std"] + +[[bench]] +name = "mnt6_753" +path = "benches/mnt6_753.rs" +harness = false diff --git a/mnt6_753/benches/mnt6_753.rs b/mnt6_753/benches/mnt6_753.rs new file mode 100644 index 0000000..25bd13c --- /dev/null +++ b/mnt6_753/benches/mnt6_753.rs @@ -0,0 +1,15 @@ +use ark_algebra_bench_templates::*; +use ark_mnt6_753::{ + fq::Fq, fq3::Fq3, fr::Fr, Fq6, G1Projective as G1, G2Projective as G2, MNT6_753, +}; + +bench!( + Name = "MNT6_753", + Pairing = MNT6_753, + G1 = G1, + G2 = G2, + ScalarField = Fr, + G1BaseField = Fq, + G2BaseField = Fq3, + TargetField = Fq6, +); diff --git a/pallas/Cargo.toml b/pallas/Cargo.toml index d581ef4..85342b2 100644 --- a/pallas/Cargo.toml +++ b/pallas/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["cryptography", "finite-fields", "elliptic-curves" ] categories = ["cryptography"] include = ["Cargo.toml", "src"] license = "MIT/Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] ark-ff = { version = "^0.3.0", default-features = false } @@ -22,6 +22,7 @@ ark-std = { version = "^0.3.0", default-features = false } ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] @@ -32,3 +33,8 @@ curve = [ "scalar_field", "base_field" ] scalar_field = [] base_field = [] r1cs = [ "base_field", "ark-r1cs-std" ] + +[[bench]] +name = "pallas" +path = "benches/pallas.rs" +harness = false \ No newline at end of file diff --git a/pallas/benches/pallas.rs b/pallas/benches/pallas.rs new file mode 100644 index 0000000..3eb70c3 --- /dev/null +++ b/pallas/benches/pallas.rs @@ -0,0 +1,9 @@ +use ark_algebra_bench_templates::*; +use ark_pallas::{fq::Fq, fr::Fr, Projective as G}; + +bench!( + Name = "Pallas", + Group = G, + ScalarField = Fr, + PrimeBaseField = Fq, +); diff --git a/rustfmt.toml b/rustfmt.toml index 6a424ff..883ae5d 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -4,6 +4,6 @@ normalize_comments = true use_try_shorthand = true match_block_trailing_comma = true use_field_init_shorthand = true -edition = "2018" +edition = "2021" condense_wildcard_suffixes = true imports_granularity="Crate" diff --git a/vesta/Cargo.toml b/vesta/Cargo.toml index a255948..34ea1d2 100644 --- a/vesta/Cargo.toml +++ b/vesta/Cargo.toml @@ -10,7 +10,7 @@ keywords = ["cryptography", "finite-fields", "elliptic-curves" ] categories = ["cryptography"] include = ["Cargo.toml", "src"] license = "MIT/Apache-2.0" -edition = "2018" +edition = "2021" [dependencies] ark-ff = { version = "^0.3.0", default-features = false } @@ -23,9 +23,15 @@ ark-pallas = { version = "^0.3.0", path = "../pallas", default-features = false, ark-relations = { version = "^0.3.0", default-features = false } ark-serialize = { version = "^0.3.0", default-features = false } ark-algebra-test-templates = { version = "^0.3.0", default-features = false } +ark-algebra-bench-templates = { version = "^0.3.0", default-features = false } ark-curve-constraint-tests = { path = "../curve-constraint-tests", default-features = false } [features] default = [] std = [ "ark-std/std", "ark-ff/std", "ark-ec/std" ] r1cs = [ "ark-r1cs-std" ] + +[[bench]] +name = "vesta" +path = "benches/vesta.rs" +harness = false \ No newline at end of file diff --git a/vesta/benches/vesta.rs b/vesta/benches/vesta.rs new file mode 100644 index 0000000..784db4f --- /dev/null +++ b/vesta/benches/vesta.rs @@ -0,0 +1,9 @@ +use ark_algebra_bench_templates::*; +use ark_vesta::{fq::Fq, fr::Fr, Projective as G}; + +bench!( + Name = "Vesta", + Group = G, + ScalarField = Fr, + PrimeBaseField = Fq, +);