diff --git a/benchmarks/benches/formatting.rs b/benchmarks/benches/formatting.rs index 25c5a0ba8..3479029f4 100644 --- a/benchmarks/benches/formatting.rs +++ b/benchmarks/benches/formatting.rs @@ -1,3 +1,5 @@ +use std::rc::Rc; + use criterion::{criterion_group, criterion_main}; use milli::tokenizer::TokenizerBuilder; use milli::{FormatOptions, MatcherBuilder, MatchingWord, MatchingWords}; @@ -18,14 +20,14 @@ fn bench_formatting(c: &mut criterion::Criterion) { name: "'the door d'", text: r#"He used to do the door sounds in "Star Trek" with his mouth, phssst, phssst. The MD-11 passenger and cargo doors also tend to behave like electromagnetic apertures, because the doors do not have continuous electrical contact with the door frames around the door perimeter. But Theodor said that the doors don't work."#, matching_words: MatcherBuilder::new(MatchingWords::new(vec![ - (vec![MatchingWord::new("t".to_string(), 0, false), MatchingWord::new("he".to_string(), 0, false)], vec![0]), - (vec![MatchingWord::new("the".to_string(), 0, false)], vec![0]), - (vec![MatchingWord::new("door".to_string(), 1, false)], vec![1]), - (vec![MatchingWord::new("do".to_string(), 0, false), MatchingWord::new("or".to_string(), 0, false)], vec![0]), - (vec![MatchingWord::new("thedoor".to_string(), 1, false)], vec![0, 1]), - (vec![MatchingWord::new("d".to_string(), 0, true)], vec![2]), - (vec![MatchingWord::new("thedoord".to_string(), 1, true)], vec![0, 1, 2]), - (vec![MatchingWord::new("doord".to_string(), 1, true)], vec![1, 2]), + (vec![Rc::new(MatchingWord::new("t".to_string(), 0, false).unwrap()), Rc::new(MatchingWord::new("he".to_string(), 0, false).unwrap())], vec![0]), + (vec![Rc::new(MatchingWord::new("the".to_string(), 0, false).unwrap())], vec![0]), + (vec![Rc::new(MatchingWord::new("door".to_string(), 1, false).unwrap())], vec![1]), + (vec![Rc::new(MatchingWord::new("do".to_string(), 0, false).unwrap()), Rc::new(MatchingWord::new("or".to_string(), 0, false).unwrap())], vec![0]), + (vec![Rc::new(MatchingWord::new("thedoor".to_string(), 1, false).unwrap())], vec![0, 1]), + (vec![Rc::new(MatchingWord::new("d".to_string(), 0, true).unwrap())], vec![2]), + (vec![Rc::new(MatchingWord::new("thedoord".to_string(), 1, true).unwrap())], vec![0, 1, 2]), + (vec![Rc::new(MatchingWord::new("doord".to_string(), 1, true).unwrap())], vec![1, 2]), ] ), TokenizerBuilder::default().build()), },