From 082ad8491404e50b90d10f68644bc6dc6ce9779a Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Sat, 31 Oct 2020 21:53:21 +0100 Subject: [PATCH] Fix the benchmarks --- benches/search.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/benches/search.rs b/benches/search.rs index b958f9ae0..a201e241c 100644 --- a/benches/search.rs +++ b/benches/search.rs @@ -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(); }