Skip to content

Commit

Permalink
add benchmark for quantile_below
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Aug 11, 2022
1 parent 5854b2e commit b77e78f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions benches/quantiles.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#![feature(test)]

extern crate test;

use hdrhistogram::*;
use test::{black_box, Bencher};

#[bench]
fn quantiles_below(b: &mut Bencher) {
let mut h = Histogram::<u32>::new_with_bounds(1, 100_000, 3).unwrap();
for i in 0..100_000 {
h.record(i).unwrap();
}

b.iter(|| {
black_box(h.quantile_below(black_box(10)));
black_box(h.quantile_below(black_box(90_000)));
})
}

0 comments on commit b77e78f

Please sign in to comment.