Fix benchmarks
This commit is contained in:
parent
b42b1f9408
commit
5ce825398a
|
@ -112,6 +112,7 @@ mod benches {
|
||||||
use rand::{Rng, thread_rng};
|
use rand::{Rng, thread_rng};
|
||||||
use test::{Bencher, black_box};
|
use test::{Bencher, black_box};
|
||||||
|
|
||||||
|
use super::SharedSecret;
|
||||||
use super::super::{Secp256k1, Message};
|
use super::super::{Secp256k1, Message};
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
|
@ -120,7 +121,6 @@ mod benches {
|
||||||
let (sk, pk) = s.generate_keypair(&mut thread_rng()).unwrap();
|
let (sk, pk) = s.generate_keypair(&mut thread_rng()).unwrap();
|
||||||
|
|
||||||
let s = Secp256k1::new();
|
let s = Secp256k1::new();
|
||||||
let mut r = CounterRng(0);
|
|
||||||
bh.iter( || {
|
bh.iter( || {
|
||||||
let res = SharedSecret::new(&s, &pk, &sk);
|
let res = SharedSecret::new(&s, &pk, &sk);
|
||||||
black_box(res);
|
black_box(res);
|
||||||
|
|
|
@ -729,7 +729,7 @@ mod benches {
|
||||||
thread_rng().fill_bytes(&mut msg);
|
thread_rng().fill_bytes(&mut msg);
|
||||||
let msg = Message::from_slice(&msg).unwrap();
|
let msg = Message::from_slice(&msg).unwrap();
|
||||||
let (sk, _) = s.generate_keypair(&mut thread_rng()).unwrap();
|
let (sk, _) = s.generate_keypair(&mut thread_rng()).unwrap();
|
||||||
let sig = s.sign(&msg, &sk).unwrap();
|
let sig = s.sign_recoverable(&msg, &sk).unwrap();
|
||||||
|
|
||||||
bh.iter(|| {
|
bh.iter(|| {
|
||||||
let res = s.recover(&msg, &sig).unwrap();
|
let res = s.recover(&msg, &sig).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue