2021-04-01 18:54:14 +02:00
|
|
|
mod utils;
|
2020-06-18 18:37:57 +02:00
|
|
|
|
2021-04-01 18:54:14 +02:00
|
|
|
use std::time::Duration;
|
2020-06-19 18:24:03 +02:00
|
|
|
use criterion::{criterion_group, criterion_main, BenchmarkId};
|
2020-06-18 18:37:57 +02:00
|
|
|
|
2021-04-01 18:54:14 +02:00
|
|
|
fn bench_typo(c: &mut criterion::Criterion) {
|
|
|
|
let index = utils::base_setup(Some(vec!["typo".to_string()]));
|
|
|
|
|
2020-06-19 18:24:03 +02:00
|
|
|
let queries = [
|
2021-04-01 18:54:14 +02:00
|
|
|
"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 18:24:03 +02:00
|
|
|
];
|
2020-06-18 18:37:57 +02:00
|
|
|
|
2021-04-01 18:54:14 +02:00
|
|
|
let mut group = c.benchmark_group("typo");
|
2021-04-01 19:27:12 +02:00
|
|
|
group.measurement_time(Duration::from_secs(10));
|
2020-06-19 18:24:03 +02:00
|
|
|
|
|
|
|
for query in &queries {
|
|
|
|
group.bench_with_input(BenchmarkId::from_parameter(query), &query, |b, &query| {
|
|
|
|
b.iter(|| {
|
2020-10-31 21:53:21 +01:00
|
|
|
let rtxn = index.read_txn().unwrap();
|
2020-09-28 13:39:17 +02:00
|
|
|
let _documents_ids = index.search(&rtxn).query(*query).execute().unwrap();
|
2020-06-19 18:24:03 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
group.finish();
|
2020-06-18 18:37:57 +02:00
|
|
|
}
|
2020-06-19 18:24:03 +02:00
|
|
|
|
2021-04-01 18:54:14 +02:00
|
|
|
criterion_group!(benches, bench_typo);
|
2020-06-19 18:24:03 +02:00
|
|
|
criterion_main!(benches);
|