Fix the benchmarks

This commit is contained in:
Kerollmops 2020-10-31 21:53:21 +01:00
parent 6d52c5b2f0
commit 082ad84914
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -11,14 +11,10 @@ fn bench_search(c: &mut criterion::Criterion) {
"minogue kylie live",
];
std::fs::create_dir_all(database).unwrap();
let env = EnvOpenOptions::new()
.map_size(100 * 1024 * 1024 * 1024) // 100 GB
.max_readers(10)
.max_dbs(5)
.open(database).unwrap();
let index = Index::new(&env).unwrap();
let mut options = EnvOpenOptions::new();
options.map_size(100 * 1024 * 1024 * 1024); // 100 GB
options.max_readers(10);
let index = Index::new(options, database).unwrap();
let mut group = c.benchmark_group("search");
group.sample_size(10);
@ -27,13 +23,12 @@ fn bench_search(c: &mut criterion::Criterion) {
for query in &queries {
group.bench_with_input(BenchmarkId::from_parameter(query), &query, |b, &query| {
b.iter(|| {
let rtxn = env.read_txn().unwrap();
let rtxn = index.read_txn().unwrap();
let _documents_ids = index.search(&rtxn).query(*query).execute().unwrap();
});
});
}
group.finish();
}