reformat all the files

This commit is contained in:
tamo
2021-04-14 13:13:33 +02:00
committed by Tamo
parent 7086009f93
commit 5d5d115608
3 changed files with 42 additions and 33 deletions

View File

@ -35,15 +35,15 @@ fn base_conf(builder: &mut Settings) {
const BASE_CONF: Conf = Conf {
dataset: "smol-songs.csv",
queries: &[
"john ", // 9097
"david ", // 4794
"charles ", // 1957
"david bowie ", // 1200
"michael jackson ", // 600
"thelonious monk ", // 303
"charles mingus ", // 142
"marcus miller ", // 60
"tamo ", // 13
"john ", // 9097
"david ", // 4794
"charles ", // 1957
"david bowie ", // 1200
"michael jackson ", // 600
"thelonious monk ", // 303
"charles mingus ", // 142
"marcus miller ", // 60
"tamo ", // 13
"Notstandskomitee ", // 4
],
configure: base_conf,
@ -69,10 +69,15 @@ fn bench_songs(c: &mut criterion::Criterion) {
.map(|s| {
s.trim()
.split(' ')
.map(|s| format!(r#""{}""#, s)).collect::<Vec<String>>().join(" ")
.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 basic_with_quote: &[&str] = &basic_with_quote
.iter()
.map(|s| s.as_str())
.collect::<Vec<&str>>();
let confs = &[
/* first we bench each criterion alone */
@ -113,10 +118,10 @@ fn bench_songs(c: &mut criterion::Criterion) {
group_name: "words",
queries: &[
"the black saint and the sinner lady and the good doggo ", // four words to pop
"les liaisons dangeureuses 1793 ", // one word to pop
"The Disneyland Children's Sing-Alone song ", // two words to pop
"seven nation mummy ", // one word to pop
"7000 Danses / Le Baiser / je me trompe de mots ", // four words to pop
"les liaisons dangeureuses 1793 ", // one word to pop
"The Disneyland Children's Sing-Alone song ", // two words to pop
"seven nation mummy ", // one word 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
"whathavenotnsuchforth and a good amount of words to pop to match the first one ", // 13
],
@ -133,7 +138,6 @@ 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",
@ -145,14 +149,11 @@ fn bench_songs(c: &mut criterion::Criterion) {
criterion: Some(&desc_default[..]),
..BASE_CONF
},
/* the we bench some global / normal search with all the default criterion in the default
* order */
utils::Conf {
group_name: "basic placeholder",
queries: &[
"",
],
queries: &[""],
..BASE_CONF
},
utils::Conf {
@ -173,14 +174,11 @@ 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
},
];
];
utils::run_benches(c, confs);
}