Apply rustfmt to benchmarks

This commit is contained in:
Sean Bowe
2018-05-17 10:50:56 -06:00
parent 97bdd1655f
commit e4143a4bbc
7 changed files with 152 additions and 128 deletions

View File

@@ -6,7 +6,7 @@ mod ec;
use rand::{Rand, SeedableRng, XorShiftRng};
use pairing::{Engine, CurveAffine};
use pairing::{CurveAffine, Engine};
use pairing::bls12_381::*;
#[bench]
@@ -47,12 +47,14 @@ fn bench_pairing_miller_loop(b: &mut ::test::Bencher) {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
let v: Vec<(G1Prepared, G2Prepared)> = (0..SAMPLES).map(|_|
(
G1Affine::from(G1::rand(&mut rng)).prepare(),
G2Affine::from(G2::rand(&mut rng)).prepare()
)
).collect();
let v: Vec<(G1Prepared, G2Prepared)> = (0..SAMPLES)
.map(|_| {
(
G1Affine::from(G1::rand(&mut rng)).prepare(),
G2Affine::from(G2::rand(&mut rng)).prepare(),
)
})
.collect();
let mut count = 0;
b.iter(|| {
@@ -68,12 +70,15 @@ fn bench_pairing_final_exponentiation(b: &mut ::test::Bencher) {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
let v: Vec<Fq12> = (0..SAMPLES).map(|_|
(
G1Affine::from(G1::rand(&mut rng)).prepare(),
G2Affine::from(G2::rand(&mut rng)).prepare()
)
).map(|(ref p, ref q)| Bls12::miller_loop(&[(p, q)])).collect();
let v: Vec<Fq12> = (0..SAMPLES)
.map(|_| {
(
G1Affine::from(G1::rand(&mut rng)).prepare(),
G2Affine::from(G2::rand(&mut rng)).prepare(),
)
})
.map(|(ref p, ref q)| Bls12::miller_loop(&[(p, q)]))
.collect();
let mut count = 0;
b.iter(|| {
@@ -89,12 +94,9 @@ fn bench_pairing_full(b: &mut ::test::Bencher) {
let mut rng = XorShiftRng::from_seed([0x5dbe6259, 0x8d313d76, 0x3237db17, 0xe5bc0654]);
let v: Vec<(G1, G2)> = (0..SAMPLES).map(|_|
(
G1::rand(&mut rng),
G2::rand(&mut rng)
)
).collect();
let v: Vec<(G1, G2)> = (0..SAMPLES)
.map(|_| (G1::rand(&mut rng), G2::rand(&mut rng)))
.collect();
let mut count = 0;
b.iter(|| {
@@ -102,4 +104,4 @@ fn bench_pairing_full(b: &mut ::test::Bencher) {
count = (count + 1) % SAMPLES;
tmp
});
}
}