diff --git a/milli/benches/songs.rs b/milli/benches/songs.rs index 0c056d93f..8ef6df3c8 100644 --- a/milli/benches/songs.rs +++ b/milli/benches/songs.rs @@ -138,6 +138,7 @@ fn bench_songs(c: &mut criterion::Criterion) { criterion: Some(&["desc(released-timestamp)"]), ..BASE_CONF }, + /* then we bench the asc and desc criterion on top of the default criterion */ utils::Conf { group_name: "asc + default", @@ -149,6 +150,24 @@ fn bench_songs(c: &mut criterion::Criterion) { criterion: Some(&desc_default[..]), ..BASE_CONF }, + + /* we bench the filters with the default request */ + utils::Conf { + group_name: "basic filter: <=", + facet_condition: Some("released-timestamp <= 946728000"), // year 2000 + ..BASE_CONF + }, + utils::Conf { + group_name: "basic filter: TO", + facet_condition: Some("released-timestamp 946728000 TO 1262347200"), // year 2000 to 2010 + ..BASE_CONF + }, + utils::Conf { + 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))"), + ..BASE_CONF + }, + /* the we bench some global / normal search with all the default criterion in the default * order */ utils::Conf { @@ -174,7 +193,10 @@ fn bench_songs(c: &mut criterion::Criterion) { group_name: "prefix search", queries: &[ "s", // 500k+ results - "a", "b", "i", "x", // only 7k results + "a", // + "b", // + "i", // + "x", // only 7k results ], ..BASE_CONF }, diff --git a/milli/benches/utils.rs b/milli/benches/utils.rs index 3d91f726a..460623ab5 100644 --- a/milli/benches/utils.rs +++ b/milli/benches/utils.rs @@ -1,7 +1,4 @@ -use std::{ - fs::{create_dir_all, remove_dir_all, File}, - time::Duration, -}; +use std::fs::{create_dir_all, remove_dir_all, File}; use criterion::BenchmarkId; use heed::EnvOpenOptions; @@ -24,7 +21,7 @@ pub struct Conf<'a> { pub criterion: Option<&'a [&'a str]>, /// the last chance to configure your database as you want pub configure: fn(&mut Settings), - pub facet_condition: Option, + pub facet_condition: Option<&'a str>, /// enable or disable the optional words on the query pub optional_words: bool, } @@ -102,7 +99,8 @@ pub fn run_benches(c: &mut criterion::Criterion, confs: &[Conf]) { let rtxn = index.read_txn().unwrap(); let mut search = index.search(&rtxn); search.query(query).optional_words(conf.optional_words); - if let Some(facet_condition) = conf.facet_condition.clone() { + if let Some(facet_condition) = conf.facet_condition { + let facet_condition = FacetCondition::from_str(&rtxn, &index, facet_condition).unwrap(); search.facet_condition(facet_condition); } let _ids = search.execute().unwrap(); diff --git a/milli/benches/wiki.rs b/milli/benches/wiki.rs index d876814a9..8c15f11ca 100644 --- a/milli/benches/wiki.rs +++ b/milli/benches/wiki.rs @@ -25,7 +25,7 @@ const BASE_CONF: Conf = Conf { "spain ", // 7002 "japan ", // 10.593 "france ", // 17.616 - "film ", // 24.959 + "film ", // 24.959 ], configure: base_conf, ..Conf::BASE