From b77e78fa83ba4f61efb97d5506b9a5bff39b7ca7 Mon Sep 17 00:00:00 2001 From: The 8472 Date: Thu, 11 Aug 2022 23:43:32 +0200 Subject: [PATCH] add benchmark for quantile_below --- benches/quantiles.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 benches/quantiles.rs diff --git a/benches/quantiles.rs b/benches/quantiles.rs new file mode 100644 index 0000000..e356818 --- /dev/null +++ b/benches/quantiles.rs @@ -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::::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))); + }) +}