-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,21 @@ | ||
#![feature(test)] | ||
|
||
extern crate rand; | ||
extern crate secp256k1; | ||
extern crate secp256k1_test; | ||
extern crate test; | ||
#[macro_use] | ||
extern crate arrayref; | ||
|
||
use rand::thread_rng; | ||
use secp256k1::{sign, Message, SecretKey}; | ||
use arrayref::array_ref; | ||
use libsecp256k1::{sign, Message, SecretKey}; | ||
use rand_test::thread_rng; | ||
use secp256k1_test::Secp256k1; | ||
use test::Bencher; | ||
|
||
#[bench] | ||
fn bench_sign_message(b: &mut Bencher) { | ||
let secp256k1 = Secp256k1::new(); | ||
let message = Message::parse(&[5u8; 32]); | ||
let (secp_privkey, _) = secp256k1.generate_keypair(&mut thread_rng()).unwrap(); | ||
let (secp_privkey, _) = secp256k1.generate_keypair(&mut thread_rng()); | ||
let seckey = SecretKey::parse(array_ref!(secp_privkey, 0, 32)).unwrap(); | ||
|
||
b.iter(|| { | ||
let _ = sign(&message, &seckey).unwrap(); | ||
let _ = sign(&message, &seckey); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters