Add a second benchmark
This commit is contained in:
parent
ff32a353f8
commit
5e232a3d6f
|
@ -5,7 +5,7 @@ use bencher::{benchmark_group, benchmark_main, Bencher};
|
||||||
use instant_segment::test_data::{crate_data_dir, segmenter};
|
use instant_segment::test_data::{crate_data_dir, segmenter};
|
||||||
use instant_segment::Search;
|
use instant_segment::Search;
|
||||||
|
|
||||||
benchmark_group!(benches, short);
|
benchmark_group!(benches, short, long);
|
||||||
benchmark_main!(benches);
|
benchmark_main!(benches);
|
||||||
|
|
||||||
fn short(bench: &mut Bencher) {
|
fn short(bench: &mut Bencher) {
|
||||||
|
@ -15,3 +15,14 @@ fn short(bench: &mut Bencher) {
|
||||||
let _ = segmenter.segment("thisisatest", &mut search);
|
let _ = segmenter.segment("thisisatest", &mut search);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn long(bench: &mut Bencher) {
|
||||||
|
let segmenter = segmenter(crate_data_dir());
|
||||||
|
let mut search = Search::default();
|
||||||
|
bench.iter(|| {
|
||||||
|
let _ = segmenter.segment(
|
||||||
|
"itwasabrightcolddayinaprilandtheclockswerestrikingthirteen",
|
||||||
|
&mut search,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue