mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-01-30 07:22:15 +00:00
Migrate zcash_primitives benchmarks to criterion
This commit is contained in:
parent
7ea1da5d6f
commit
00499b3441
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -968,6 +968,7 @@ dependencies = [
|
||||
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"blake2s_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"criterion 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"crypto_api_chachapoly 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ff 0.5.0",
|
||||
"fpe 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -31,11 +31,16 @@ sha2 = "0.8"
|
||||
subtle = "2.2.1"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.3"
|
||||
hex-literal = "0.2"
|
||||
rand_xorshift = "0.2"
|
||||
|
||||
[features]
|
||||
transparent-inputs = ["ripemd160", "secp256k1"]
|
||||
|
||||
[[bench]]
|
||||
name = "pedersen_hash"
|
||||
harness = false
|
||||
|
||||
[badges]
|
||||
maintenance = { status = "actively-developed" }
|
||||
|
@ -1,17 +1,10 @@
|
||||
#![feature(test)]
|
||||
|
||||
extern crate pairing;
|
||||
extern crate rand_core;
|
||||
extern crate test;
|
||||
extern crate zcash_primitives;
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use pairing::bls12_381::Bls12;
|
||||
use rand_core::{OsRng, RngCore};
|
||||
use zcash_primitives::jubjub::JubjubBls12;
|
||||
use zcash_primitives::pedersen_hash::{pedersen_hash, Personalization};
|
||||
|
||||
#[bench]
|
||||
fn bench_pedersen_hash(b: &mut test::Bencher) {
|
||||
fn bench_pedersen_hash(c: &mut Criterion) {
|
||||
let params = JubjubBls12::new();
|
||||
let rng = &mut OsRng;
|
||||
let bits = (0..510)
|
||||
@ -19,5 +12,10 @@ fn bench_pedersen_hash(b: &mut test::Bencher) {
|
||||
.collect::<Vec<_>>();
|
||||
let personalization = Personalization::MerkleTree(31);
|
||||
|
||||
b.iter(|| pedersen_hash::<Bls12, _>(personalization, bits.clone(), ¶ms));
|
||||
c.bench_function("Pedersen hash", |b| {
|
||||
b.iter(|| pedersen_hash::<Bls12, _>(personalization, bits.clone(), ¶ms))
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, bench_pedersen_hash);
|
||||
criterion_main!(benches);
|
||||
|
Loading…
Reference in New Issue
Block a user