Improvements

This commit is contained in:
Pratyush Mishra
2020-12-10 18:36:49 -08:00
parent ac0dcc7ae9
commit 3198749ccb
3 changed files with 82 additions and 91 deletions

View File

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

View File

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

View File

@@ -2,8 +2,7 @@
macro_rules! f_bench { macro_rules! f_bench {
// Use this for base fields // Use this for base fields
($f:ident, $f_type:ty, $f_repr:ident, $f_repr_type:ty, $modname:ident) => { ($f:ident, $f_type:ty, $f_repr:ident, $f_repr_type:ty, $modname:ident) => {
$crate::paste!{ pub mod $modname {
pub mod [<_ $modname>] {
use super::*; use super::*;
field_common!($f, $f_type); field_common!($f, $f_type);
sqrt!($f, $f_type); sqrt!($f, $f_type);
@@ -34,13 +33,11 @@ macro_rules! f_bench {
from_repr, from_repr,
); );
} }
use [<_ $modname>]::$modname; use $modname::$modname;
}
}; };
// use this for intermediate fields // use this for intermediate fields
(extension, $f:ident, $f_type:ty, $modname:ident) => { (extension, $f:ident, $f_type:ty, $modname:ident) => {
$crate::paste!{ mod $modname {
mod [<_ $modname>] {
use super::*; use super::*;
field_common!($f, $f_type); field_common!($f, $f_type);
sqrt!($f, $f_type); sqrt!($f, $f_type);
@@ -62,13 +59,11 @@ macro_rules! f_bench {
sqrt, sqrt,
); );
} }
use [<_ $modname>]::$modname; use $modname::$modname;
}
}; };
// Use this for the full extension field Fqk // Use this for the full extension field Fqk
(target, $f:ident, $f_type:ty, $modname:ident) => { (target, $f:ident, $f_type:ty, $modname:ident) => {
crate::paste! { mod $modname {
mod [<_ $modname>] {
use super::*; use super::*;
field_common!($f, $f_type); field_common!($f, $f_type);
$crate::benchmark_group!( $crate::benchmark_group!(
@@ -87,8 +82,7 @@ macro_rules! f_bench {
deser_unchecked, deser_unchecked,
); );
} }
use [<_ $modname>]::$modname; use $modname::$modname;
}
}; };
} }