add an "extra long" benchmark

This commit is contained in:
David Hotham 2024-02-10 12:24:09 +00:00 committed by Dirkjan Ochtman
parent 168e48b69c
commit a63a57d94d
1 changed files with 12 additions and 1 deletions

View File

@ -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, long); benchmark_group!(benches, short, long, extra_long);
benchmark_main!(benches); benchmark_main!(benches);
fn short(bench: &mut Bencher) { fn short(bench: &mut Bencher) {
@ -26,3 +26,14 @@ fn long(bench: &mut Bencher) {
); );
}); });
} }
fn extra_long(bench: &mut Bencher) {
let segmenter = segmenter(crate_data_dir());
let mut search = Search::default();
bench.iter(|| {
let _ = segmenter.segment(
"itwasthebestoftimesitwastheworstoftimesitwastheageofwisdomitwastheageoffoolishnessitwastheepochofbeliefitwastheepochofincredulityitwastheseasonoflightitwastheseasonofdarknessitwasthespringofhopeitwasthewinterofdespair",
&mut search,
);
});
}