-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from the8472/opt-quantiles
Optimize quantile_below, 100x speedup
- Loading branch information
Showing
2 changed files
with
40 additions
and
3 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
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))); | ||
}) | ||
} |
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