#![feature(test)] extern crate rand; extern crate test; extern crate bellman; extern crate sapling_crypto_ce as sapling_crypto; use rand::{Rand, thread_rng}; use bellman::pairing::bn256::Bn256; use sapling_crypto::alt_babyjubjub::AltJubjubBn256; use sapling_crypto::pedersen_hash::{pedersen_hash, Personalization}; #[bench] fn bench_baby_pedersen_hash(b: &mut test::Bencher) { let params = AltJubjubBn256::new(); let rng = &mut thread_rng(); let bits = (0..510).map(|_| bool::rand(rng)).collect::>(); let personalization = Personalization::MerkleTree(31); b.iter(|| { pedersen_hash::(personalization, bits.clone(), ¶ms) }); }