Skip to content

Commit

Permalink
Benchmark for key ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky authored and tcharding committed Jun 14, 2022
1 parent 999d165 commit 0faf404
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2204,3 +2204,24 @@ mod test {
assert_eq!(got, want)
}
}

#[cfg(all(test, feature = "unstable"))]
mod benches {
use test::Bencher;
use std::collections::BTreeSet;
use crate::PublicKey;
use crate::constants::GENERATOR_X;

#[bench]
fn bench_pk_ordering(b: &mut Bencher) {
let mut map = BTreeSet::new();
let mut g_slice = [02u8; 33];
g_slice[1..].copy_from_slice(&GENERATOR_X);
let g = PublicKey::from_slice(&g_slice).unwrap();
let mut pk = g;
b.iter(|| {
map.insert(pk);
pk = pk.combine(&pk).unwrap();
})
}
}

0 comments on commit 0faf404

Please sign in to comment.