fix(core): fix benchmark in core with types

forces a dereference onto query and then creates an option to wrap the
query

Closes 994
This commit is contained in:
nd419 2020-10-08 13:37:58 +01:00
parent b406b6ee44
commit 0a2ca075d3
No known key found for this signature in database
GPG Key ID: A046D48D79B2E233

View File

@ -15,7 +15,7 @@ use meilisearch_core::settings::{Settings, SettingsUpdate};
use meilisearch_schema::Schema;
use serde_json::Value;
use criterion::{criterion_group, criterion_main, Criterion, BenchmarkId};
use criterion::{black_box, criterion_group, criterion_main, Criterion, BenchmarkId};
fn prepare_database(path: &Path) -> Database {
let database = Database::open_or_create(path, DatabaseOptions::default()).unwrap();
@ -98,7 +98,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let bench_name = BenchmarkId::from_parameter(format!("{:?}", query));
group.bench_with_input(bench_name, &query, |b, query| b.iter(|| {
let builder = index.query_builder();
builder.query(&reader, query, 0..20).unwrap();
builder.query(&reader, Some(*query), 0..20).unwrap();
}));
}
group.finish();