improve the base search

This commit is contained in:
tamo 2021-04-14 12:36:12 +02:00 committed by Tamo
parent d0b44c380f
commit 7086009f93
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69

View File

@ -35,17 +35,16 @@ fn base_conf(builder: &mut Settings) {
const BASE_CONF: Conf = Conf { const BASE_CONF: Conf = Conf {
dataset: "smol-songs.csv", dataset: "smol-songs.csv",
queries: &[ queries: &[
"mingus ", "john ", // 9097
"thelonious monk ", "david ", // 4794
"Disneyland ", "charles ", // 1957
"the white stripes ", "david bowie ", // 1200
"indochine ", "michael jackson ", // 600
"klub des loosers ", "thelonious monk ", // 303
"fear of the dark ", "charles mingus ", // 142
"michel delpech ", "marcus miller ", // 60
"stromae ", "tamo ", // 13
"dire straits ", "Notstandskomitee ", // 4
"aretha franklin ",
], ],
configure: base_conf, configure: base_conf,
..Conf::BASE ..Conf::BASE
@ -64,6 +63,17 @@ fn bench_songs(c: &mut criterion::Criterion) {
.chain(default_criterion.clone()) .chain(default_criterion.clone())
.collect(); .collect();
let basic_with_quote: Vec<String> = BASE_CONF
.queries
.iter()
.map(|s| {
s.trim()
.split(' ')
.map(|s| format!(r#""{}""#, s)).collect::<Vec<String>>().join(" ")
})
.collect();
let basic_with_quote: &[&str] = &basic_with_quote.iter().map(|s| s.as_str()).collect::<Vec<&str>>();
let confs = &[ let confs = &[
/* first we bench each criterion alone */ /* first we bench each criterion alone */
utils::Conf { utils::Conf {
@ -108,7 +118,7 @@ fn bench_songs(c: &mut criterion::Criterion) {
"seven nation mummy ", // one word to pop "seven nation mummy ", // one word to pop
"7000 Danses / Le Baiser / je me trompe de mots ", // four words to pop "7000 Danses / Le Baiser / je me trompe de mots ", // four words to pop
"Bring Your Daughter To The Slaughter but now this is not part of the title ", // nine words to pop "Bring Your Daughter To The Slaughter but now this is not part of the title ", // nine words to pop
"whathavenotnsuchforth and a good amount of words to pop to match the first one ", // 16 "whathavenotnsuchforth and a good amount of words to pop to match the first one ", // 13
], ],
criterion: Some(&["words"]), criterion: Some(&["words"]),
..BASE_CONF ..BASE_CONF
@ -147,22 +157,16 @@ fn bench_songs(c: &mut criterion::Criterion) {
}, },
utils::Conf { utils::Conf {
group_name: "basic without quote", group_name: "basic without quote",
queries: &[ queries: &BASE_CONF
"david bowie", // 1200 .queries
"michael jackson", // 600 .iter()
"marcus miller", // 60 .map(|s| s.trim()) // we remove the space at the end of each request
"Notstandskomitee", // 4 .collect::<Vec<&str>>(),
],
..BASE_CONF ..BASE_CONF
}, },
utils::Conf { utils::Conf {
group_name: "basic with quote", group_name: "basic with quote",
queries: &[ queries: basic_with_quote,
"\"david\" \"bowie\"", // 1200
"\"michael\" \"jackson\"", // 600
"\"marcus\" \"miller\"", // 60
"\"Notstandskomitee\"", // 4
],
..BASE_CONF ..BASE_CONF
}, },
utils::Conf { utils::Conf {