Optimize things

This commit is contained in:
Kerollmops
2020-06-18 18:37:57 +02:00
parent a3ca80d20d
commit 55a8941922
4 changed files with 85 additions and 54 deletions

25
benches/search.rs Normal file
View File

@ -0,0 +1,25 @@
#![feature(test)]
extern crate test;
use heed::EnvOpenOptions;
use mega_mini_indexer::Index;
#[bench]
fn search_minogue_kylie_live(b: &mut test::Bencher) {
let database = "books-4cpu.mmdb";
let query = "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();
b.iter(|| {
let rtxn = env.read_txn().unwrap();
let _documents_ids = index.search(&rtxn, query).unwrap();
})
}