instant-segment/benches/bench.rs

19 lines
406 B
Rust
Raw Normal View History

2020-05-28 17:56:13 +00:00
use std::path::PathBuf;
use bencher::{benchmark_group, benchmark_main, Bencher};
use word_segmenters::Segmenter;
benchmark_group!(benches, short);
benchmark_main!(benches);
fn short(bench: &mut Bencher) {
let segmenter = Segmenter::from_dir(&PathBuf::from(format!(
"{}/data",
env!("CARGO_MANIFEST_DIR")
)))
.unwrap();
bench.iter(|| segmenter.segment("thisisatest"));
}