Browse Source

Improvements

fq2_neg_nonresidue
Pratyush Mishra 4 years ago
parent
commit
3198749ccb
3 changed files with 82 additions and 91 deletions
  1. +13
    -12
      curve-benches/Cargo.toml
  2. +0
    -4
      curve-benches/src/lib.rs
  3. +69
    -75
      curve-benches/src/macros/field.rs

+ 13
- 12
curve-benches/Cargo.toml

@ -24,22 +24,23 @@ build = "build.rs"
################################# Dependencies ################################
[dependencies]
bencher = { version = "0.1.5" }
[dev-dependencies]
ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-ff = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-serialize = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
ark-mnt4-298 = { path = "../mnt4_298", optional = true }
ark-mnt6-298 = { path = "../mnt6_298", optional = true }
ark-mnt4-753 = { path = "../mnt4_753", optional = true }
ark-mnt6-753 = { path = "../mnt6_753", optional = true }
ark-bn254 = { path = "../bn254", optional = true }
ark-bls12-377 = { path = "../bls12_377", optional = true }
ark-bls12-381 = { path = "../bls12_381", optional = true }
ark-ed-on-bls12-381 = { path = "../ed_on_bls12_381", optional = true }
ark-bw6-761 = { path = "../bw6_761", optional = true }
ark-cp6-782 = { path = "../cp6_782", optional = true }
bencher = { version = "0.1.5" }
paste = { version = "1.0" }
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" }
rand = "0.7"
rand_xorshift = { version = "0.2" }

+ 0
- 4
curve-benches/src/lib.rs

@ -6,7 +6,3 @@ pub use macros::*;
#[macro_use]
pub extern crate bencher;
pub use bencher::*;
#[macro_use]
pub extern crate paste;
pub use paste::*;

+ 69
- 75
curve-benches/src/macros/field.rs

@ -2,93 +2,87 @@
macro_rules! f_bench {
// Use this for base fields
($f:ident, $f_type:ty, $f_repr:ident, $f_repr_type:ty, $modname:ident) => {
$crate::paste!{
pub mod [<_ $modname>] {
use super::*;
field_common!($f, $f_type);
sqrt!($f, $f_type);
prime_field!($f, $f_type, $f_repr, $f_repr_type);
$crate::benchmark_group!(
$modname,
// common stuff
add_assign,
sub_assign,
double,
negate,
mul_assign,
square,
inverse,
ser,
deser,
ser_unchecked,
deser_unchecked,
// sqrt field stuff
sqrt,
// prime field stuff
repr_add_nocarry,
repr_sub_noborrow,
repr_num_bits,
repr_mul2,
repr_div2,
into_repr,
from_repr,
pub mod $modname {
use super::*;
field_common!($f, $f_type);
sqrt!($f, $f_type);
prime_field!($f, $f_type, $f_repr, $f_repr_type);
$crate::benchmark_group!(
$modname,
// common stuff
add_assign,
sub_assign,
double,
negate,
mul_assign,
square,
inverse,
ser,
deser,
ser_unchecked,
deser_unchecked,
// sqrt field stuff
sqrt,
// prime field stuff
repr_add_nocarry,
repr_sub_noborrow,
repr_num_bits,
repr_mul2,
repr_div2,
into_repr,
from_repr,
);
}
use [<_ $modname>]::$modname;
}
use $modname::$modname;
};
// use this for intermediate fields
(extension, $f:ident, $f_type:ty, $modname:ident) => {
$crate::paste!{
mod [<_ $modname>] {
use super::*;
field_common!($f, $f_type);
sqrt!($f, $f_type);
$crate::benchmark_group!(
$modname,
// common stuff
add_assign,
sub_assign,
double,
negate,
mul_assign,
square,
inverse,
ser,
deser,
ser_unchecked,
deser_unchecked,
// sqrt field stuff
sqrt,
mod $modname {
use super::*;
field_common!($f, $f_type);
sqrt!($f, $f_type);
$crate::benchmark_group!(
$modname,
// common stuff
add_assign,
sub_assign,
double,
negate,
mul_assign,
square,
inverse,
ser,
deser,
ser_unchecked,
deser_unchecked,
// sqrt field stuff
sqrt,
);
}
use [<_ $modname>]::$modname;
}
use $modname::$modname;
};
// Use this for the full extension field Fqk
(target, $f:ident, $f_type:ty, $modname:ident) => {
crate::paste! {
mod [<_ $modname>] {
use super::*;
field_common!($f, $f_type);
$crate::benchmark_group!(
$modname,
// common stuff
add_assign,
sub_assign,
double,
negate,
mul_assign,
square,
inverse,
ser,
deser,
ser_unchecked,
deser_unchecked,
mod $modname {
use super::*;
field_common!($f, $f_type);
$crate::benchmark_group!(
$modname,
// common stuff
add_assign,
sub_assign,
double,
negate,
mul_assign,
square,
inverse,
ser,
deser,
ser_unchecked,
deser_unchecked,
);
}
use [<_ $modname>]::$modname;
}
use $modname::$modname;
};
}

Loading…
Cancel
Save