instant-segment/benches/bench.rs

20 lines
446 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();
2020-11-23 12:52:51 +00:00
let mut out = Vec::new();
bench.iter(|| segmenter.segment("thisisatest", &mut out));
2020-05-28 17:56:13 +00:00
}