meilisearch/milli/benches/typo.rs

41 lines
1.0 KiB
Rust
Raw Normal View History

mod utils;
2020-06-19 00:37:57 +08:00
use std::time::Duration;
use criterion::{criterion_group, criterion_main, BenchmarkId};
2020-06-19 00:37:57 +08:00
fn bench_typo(c: &mut criterion::Criterion) {
let index = utils::base_setup(Some(vec!["typo".to_string()]));
let queries = [
"mongus ",
"thelonius monk ",
"Disnaylande ",
"the white striper ",
"indochie ",
"indochien ",
"klub des loopers ",
"fear of the duck ",
"michel depech ",
"stromal ",
"dire straights ",
"Arethla Franklin ",
];
2020-06-19 00:37:57 +08:00
let mut group = c.benchmark_group("typo");
group.measurement_time(Duration::from_secs(10));
for query in &queries {
group.bench_with_input(BenchmarkId::from_parameter(query), &query, |b, &query| {
b.iter(|| {
2020-11-01 04:53:21 +08:00
let rtxn = index.read_txn().unwrap();
2020-09-28 19:39:17 +08:00
let _documents_ids = index.search(&rtxn).query(*query).execute().unwrap();
});
});
}
group.finish();
2020-06-19 00:37:57 +08:00
}
criterion_group!(benches, bench_typo);
criterion_main!(benches);