210: Check the benchmarks in the CI r=Kerollmops a=Kerollmops

Fixes #209.

Co-authored-by: Kerollmops <clement@meilisearch.com>
This commit is contained in:
bors[bot] 2021-06-03 09:16:06 +00:00 committed by GitHub
commit fd598f060c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 13 deletions

View File

@ -29,6 +29,11 @@ jobs:
override: true override: true
components: rustfmt, clippy components: rustfmt, clippy
- uses: actions-rs/cargo@v1
with:
command: check
args: --all
- uses: actions-rs/cargo@v1 - uses: actions-rs/cargo@v1
with: with:
command: build command: build
@ -37,6 +42,11 @@ jobs:
with: with:
command: test command: test
- uses: actions-rs/cargo@v1
with:
command: bench
args: --no-run -p benchmarks
# - uses: actions-rs/cargo@v1 # - uses: actions-rs/cargo@v1
# with: # with:
# command: bench # command: bench

View File

@ -30,7 +30,7 @@ fn base_conf(builder: &mut Settings) {
.iter() .iter()
.map(|s| s.to_string()) .map(|s| s.to_string())
.collect(); .collect();
builder.set_faceted_fields(faceted_fields); builder.set_filterable_fields(faceted_fields);
} }
const BASE_CONF: Conf = Conf { const BASE_CONF: Conf = Conf {
@ -156,17 +156,17 @@ fn bench_songs(c: &mut criterion::Criterion) {
/* we bench the filters with the default request */ /* we bench the filters with the default request */
utils::Conf { utils::Conf {
group_name: "basic filter: <=", group_name: "basic filter: <=",
facet_condition: Some("released-timestamp <= 946728000"), // year 2000 filter: Some("released-timestamp <= 946728000"), // year 2000
..BASE_CONF ..BASE_CONF
}, },
utils::Conf { utils::Conf {
group_name: "basic filter: TO", group_name: "basic filter: TO",
facet_condition: Some("released-timestamp 946728000 TO 1262347200"), // year 2000 to 2010 filter: Some("released-timestamp 946728000 TO 1262347200"), // year 2000 to 2010
..BASE_CONF ..BASE_CONF
}, },
utils::Conf { utils::Conf {
group_name: "big filter", group_name: "big filter",
facet_condition: Some("released-timestamp != 1262347200 AND (NOT (released-timestamp = 946728000)) AND (duration-float = 1 OR (duration-float 1.1 TO 1.5 AND released-timestamp > 315576000))"), filter: Some("released-timestamp != 1262347200 AND (NOT (released-timestamp = 946728000)) AND (duration-float = 1 OR (duration-float 1.1 TO 1.5 AND released-timestamp > 315576000))"),
..BASE_CONF ..BASE_CONF
}, },

View File

@ -4,7 +4,7 @@ use criterion::BenchmarkId;
use heed::EnvOpenOptions; use heed::EnvOpenOptions;
use milli::{ use milli::{
update::{IndexDocumentsMethod, Settings, UpdateBuilder, UpdateFormat}, update::{IndexDocumentsMethod, Settings, UpdateBuilder, UpdateFormat},
FacetCondition, Index, FilterCondition, Index,
}; };
pub struct Conf<'a> { pub struct Conf<'a> {
@ -21,7 +21,7 @@ pub struct Conf<'a> {
pub criterion: Option<&'a [&'a str]>, pub criterion: Option<&'a [&'a str]>,
/// the last chance to configure your database as you want /// the last chance to configure your database as you want
pub configure: fn(&mut Settings), pub configure: fn(&mut Settings),
pub facet_condition: Option<&'a str>, pub filter: Option<&'a str>,
/// enable or disable the optional words on the query /// enable or disable the optional words on the query
pub optional_words: bool, pub optional_words: bool,
/// primary key, if there is None we'll auto-generate docids for every documents /// primary key, if there is None we'll auto-generate docids for every documents
@ -36,7 +36,7 @@ impl Conf<'_> {
queries: &[], queries: &[],
criterion: None, criterion: None,
configure: |_| (), configure: |_| (),
facet_condition: None, filter: None,
optional_words: true, optional_words: true,
primary_key: None, primary_key: None,
}; };
@ -64,7 +64,7 @@ pub fn base_setup(conf: &Conf) -> Index {
let mut builder = update_builder.settings(&mut wtxn, &index); let mut builder = update_builder.settings(&mut wtxn, &index);
if let Some(criterion) = conf.criterion { if let Some(criterion) = conf.criterion {
builder.reset_faceted_fields(); builder.reset_filterable_fields();
builder.reset_criteria(); builder.reset_criteria();
builder.reset_stop_words(); builder.reset_stop_words();
@ -105,10 +105,10 @@ pub fn run_benches(c: &mut criterion::Criterion, confs: &[Conf]) {
let rtxn = index.read_txn().unwrap(); let rtxn = index.read_txn().unwrap();
let mut search = index.search(&rtxn); let mut search = index.search(&rtxn);
search.query(query).optional_words(conf.optional_words); search.query(query).optional_words(conf.optional_words);
if let Some(facet_condition) = conf.facet_condition { if let Some(filter) = conf.filter {
let facet_condition = let filter =
FacetCondition::from_str(&rtxn, &index, facet_condition).unwrap(); FilterCondition::from_str(&rtxn, &index, filter).unwrap();
search.facet_condition(facet_condition); search.filter(filter);
} }
let _ids = search.execute().unwrap(); let _ids = search.execute().unwrap();
}); });

View File

@ -83,7 +83,7 @@ fn bench_songs(c: &mut criterion::Criterion) {
group_name: "words", group_name: "words",
queries: &[ queries: &[
"the black saint and the sinner lady and the good doggo ", // four words to pop, 27 results "the black saint and the sinner lady and the good doggo ", // four words to pop, 27 results
"Kameya Tokujirō mingus monk ", // two words to pop, 55 "Kameya Tokujirō mingus monk ", // two words to pop, 55
"Ulrich Hensel meilisearch milli ", // two words to pop, 306 "Ulrich Hensel meilisearch milli ", // two words to pop, 306
"Idaho Bellevue pizza ", // one word to pop, 800 "Idaho Bellevue pizza ", // one word to pop, 800
"Abraham machin ", // one word to pop, 1141 "Abraham machin ", // one word to pop, 1141