mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 13:24:27 +01:00
30 lines
738 B
Rust
30 lines
738 B
Rust
#![feature(test)]
|
|
|
|
extern crate test;
|
|
extern crate fst;
|
|
extern crate raptor;
|
|
|
|
use fst::Streamer;
|
|
use raptor::{load_map, RankedStream, LevBuilder};
|
|
|
|
#[bench]
|
|
fn chauve_souris(b: &mut test::Bencher) {
|
|
let lev_builder = LevBuilder::new();
|
|
let map = load_map("map.fst", "values.vecs").unwrap();
|
|
|
|
let query = "chauve souris";
|
|
|
|
b.iter(|| {
|
|
let mut automatons = Vec::new();
|
|
for query in query.split_whitespace() {
|
|
let lev = lev_builder.build_automaton(query);
|
|
automatons.push(lev);
|
|
}
|
|
|
|
let mut stream = RankedStream::new(&map, &map.values(), automatons, 20);
|
|
while let Some(document_id) = stream.next() {
|
|
test::black_box(document_id);
|
|
}
|
|
})
|
|
}
|