| 1 | use criterionrust-analyzer cargo criterion 0.5.1 crate/::{black_boxrust-analyzer cargo criterion 0.5.1 black_box()., criterion_grouprust-analyzer cargo criterion 0.5.1 macros/criterion_group!, criterion_mainrust-analyzer cargo criterion 0.5.1 macros/criterion_main!, Criterionrust-analyzer cargo criterion 0.5.1 Criterion#}; |
| 2 | use globrust-analyzer cargo glob 0.3.3 crate/::Patternrust-analyzer cargo glob 0.3.3 Pattern#; |
| 3 | use regexrust-analyzer cargo regex 1.11.2 crate/::Regexrust-analyzer cargo regex 1.11.2 regex/string/Regex#; |
| 4 | use regex_literust-analyzer cargo regex-lite 0.1.7 crate/::Regexrust-analyzer cargo regex-lite 0.1.7 string/Regex# as RegexLiterust-analyzer cargo regex-lite 0.1.7 string/Regex#; |
| 5 | use wildmatchrust-analyzer cargo wildmatch 2.6.1 crate/::WildMatchrust-analyzer cargo wildmatch 2.6.1 WildMatch#; |
| 6 | |
| 7 | const TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.: &str = "Lorem ipsum dolor sit amet, \ |
| 8 | consetetur sadipscing elitr, sed diam nonumy eirmod tempor \ |
| 9 | invidunt ut labore et dolore magna aliquyam erat, sed diam \ |
| 10 | voluptua. At vero eos et accusam et justo duo dolores et ea \ |
| 11 | rebum. Stet clita kasd gubergren, no sea takimata sanctus est \ |
| 12 | Lorem ipsum dolor sit amet."; |
| 13 | |
| 14 | const FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.: &str = TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.; |
| 15 | const FULL_TEXT_REGEXrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_REGEX.: &str = "^Lorem ipsum dolor sit amet, \ |
| 16 | consetetur sadipscing elitr, sed diam nonumy eirmod tempor \ |
| 17 | invidunt ut labore et dolore magna aliquyam erat, sed diam \ |
| 18 | voluptua\\. At vero eos et accusam et justo duo dolores et ea \ |
| 19 | rebum\\. Stet clita kasd gubergren, no sea takimata sanctus est \ |
| 20 | Lorem ipsum dolor sit amet\\.$"; |
| 21 | |
| 22 | const COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 COMPLEX_PATTERN.: &str = "Lorem?ipsum*dolore*ea* ?????ata*."; |
| 23 | const COMPLEX_REGEXrust-analyzer cargo wildmatch 2.6.1 COMPLEX_REGEX.: &str = "^Lorem.ipsum.*dolore.*ea.* .....ata.*\\.$"; |
| 24 | |
| 25 | const MOST_COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 MOST_COMPLEX_PATTERN.: &str = "?a*b*?**c?d****?e*f*g*?*h?i*?*?**j*******k"; |
| 26 | const MOST_COMPLEX_REGEXrust-analyzer cargo wildmatch 2.6.1 MOST_COMPLEX_REGEX.: &str = |
| 27 | "^.a.*b.*..*.*c.d.*.*.*.*.e.*f.*g.*..*h.i.*..*..*.*j.*.*.*.*.*.*.*k$"; |
| 28 | |
| 29 | pub fn compilingrust-analyzer cargo wildmatch 2.6.1 compiling().(c: &mut Criterionrust-analyzer cargo criterion 0.5.1 Criterion#) { |
| 30 | let mut group = c.benchmark_grouprust-analyzer cargo criterion 0.5.1 impl#[`Criterion<M>`]benchmark_group().("compiling"); |
| 31 | |
| 32 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile text (wildmatch)", |b| { |
| 33 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| WildMatchrust-analyzer cargo wildmatch 2.6.1 WildMatch#::newrust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.))) |
| 34 | }); |
| 35 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile complex (wildmatch)", |b| { |
| 36 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| WildMatchrust-analyzer cargo wildmatch 2.6.1 WildMatch#::newrust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(MOST_COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 MOST_COMPLEX_PATTERN.))) |
| 37 | }); |
| 38 | |
| 39 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile text (regex)", |b| { |
| 40 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| Regexrust-analyzer cargo regex 1.11.2 regex/string/Regex#::newrust-analyzer cargo regex 1.11.2 regex/string/impl#[Regex]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(FULL_TEXT_REGEXrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_REGEX.)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()) |
| 41 | }); |
| 42 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile complex (regex)", |b| { |
| 43 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| Regexrust-analyzer cargo regex 1.11.2 regex/string/Regex#::newrust-analyzer cargo regex 1.11.2 regex/string/impl#[Regex]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(MOST_COMPLEX_REGEXrust-analyzer cargo wildmatch 2.6.1 MOST_COMPLEX_REGEX.)).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().()) |
| 44 | }); |
| 45 | |
| 46 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile text (glob)", |b| { |
| 47 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| Patternrust-analyzer cargo glob 0.3.3 Pattern#::newrust-analyzer cargo glob 0.3.3 impl#[Pattern]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.))) |
| 48 | }); |
| 49 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile complex (glob)", |b| { |
| 50 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| Patternrust-analyzer cargo glob 0.3.3 Pattern#::newrust-analyzer cargo glob 0.3.3 impl#[Pattern]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(MOST_COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 MOST_COMPLEX_PATTERN.))) |
| 51 | }); |
| 52 | |
| 53 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile text (regex_lite)", |b| { |
| 54 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| RegexLiterust-analyzer cargo regex-lite 0.1.7 string/Regex#::newrust-analyzer cargo regex-lite 0.1.7 string/impl#[Regex]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.))) |
| 55 | }); |
| 56 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("compile complex (regex_lite)", |b| { |
| 57 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| RegexLiterust-analyzer cargo regex-lite 0.1.7 string/Regex#::newrust-analyzer cargo regex-lite 0.1.7 string/impl#[Regex]new().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(MOST_COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 MOST_COMPLEX_PATTERN.))) |
| 58 | }); |
| 59 | } |
| 60 | |
| 61 | pub fn matchingrust-analyzer cargo wildmatch 2.6.1 matching().(c: &mut Criterionrust-analyzer cargo criterion 0.5.1 Criterion#) { |
| 62 | let pattern1 = WildMatchrust-analyzer cargo wildmatch 2.6.1 WildMatch#::newrust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`]new().(FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.); |
| 63 | let pattern2 = WildMatchrust-analyzer cargo wildmatch 2.6.1 WildMatch#::newrust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`]new().(COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 COMPLEX_PATTERN.); |
| 64 | let regex1 = Regexrust-analyzer cargo regex 1.11.2 regex/string/Regex#::newrust-analyzer cargo regex 1.11.2 regex/string/impl#[Regex]new().(FULL_TEXT_REGEXrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_REGEX.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 65 | let regex2 = Regexrust-analyzer cargo regex 1.11.2 regex/string/Regex#::newrust-analyzer cargo regex 1.11.2 regex/string/impl#[Regex]new().(COMPLEX_REGEXrust-analyzer cargo wildmatch 2.6.1 COMPLEX_REGEX.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 66 | let glob1 = Patternrust-analyzer cargo glob 0.3.3 Pattern#::newrust-analyzer cargo glob 0.3.3 impl#[Pattern]new().(FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 67 | let glob2 = Patternrust-analyzer cargo glob 0.3.3 Pattern#::newrust-analyzer cargo glob 0.3.3 impl#[Pattern]new().(COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 COMPLEX_PATTERN.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 68 | let regex_lite1 = RegexLiterust-analyzer cargo regex-lite 0.1.7 string/Regex#::newrust-analyzer cargo regex-lite 0.1.7 string/impl#[Regex]new().(FULL_TEXT_PATTERNrust-analyzer cargo wildmatch 2.6.1 FULL_TEXT_PATTERN.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 69 | let regex_lite2 = RegexLiterust-analyzer cargo regex-lite 0.1.7 string/Regex#::newrust-analyzer cargo regex-lite 0.1.7 string/impl#[Regex]new().(COMPLEX_PATTERNrust-analyzer cargo wildmatch 2.6.1 COMPLEX_PATTERN.).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 70 | |
| 71 | let mut group = c.benchmark_grouprust-analyzer cargo criterion 0.5.1 impl#[`Criterion<M>`]benchmark_group().("matching"); |
| 72 | |
| 73 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match text (wildmatch)", |b| { |
| 74 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| pattern1 rust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`][`PartialEq<&'a str>`]eq().==rust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`][`PartialEq<&'a str>`]eq(). rust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`][`PartialEq<&'a str>`]eq().black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.)) |
| 75 | }); |
| 76 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match complex (wildmatch)", |b| { |
| 77 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| pattern2 rust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`][`PartialEq<&'a str>`]eq().==rust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`][`PartialEq<&'a str>`]eq(). rust-analyzer cargo wildmatch 2.6.1 impl#[`WildMatchPattern<MULTI_WILDCARD, SINGLE_WILDCARD>`][`PartialEq<&'a str>`]eq().black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.)) |
| 78 | }); |
| 79 | |
| 80 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match text (regex)", |b| { |
| 81 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| regex1.is_matchrust-analyzer cargo regex 1.11.2 regex/string/impl#[Regex]is_match().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.))) |
| 82 | }); |
| 83 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match complex (regex)", |b| { |
| 84 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| regex2.is_matchrust-analyzer cargo regex 1.11.2 regex/string/impl#[Regex]is_match().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.))) |
| 85 | }); |
| 86 | |
| 87 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match text (glob)", |b| { |
| 88 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| glob1.matchesrust-analyzer cargo glob 0.3.3 impl#[Pattern]matches().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.))) |
| 89 | }); |
| 90 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match complex (glob)", |b| { |
| 91 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| glob2.matchesrust-analyzer cargo glob 0.3.3 impl#[Pattern]matches().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.))) |
| 92 | }); |
| 93 | |
| 94 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match text (regex_lite)", |b| { |
| 95 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| regex_lite1.is_matchrust-analyzer cargo regex-lite 0.1.7 string/impl#[Regex]is_match().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.))) |
| 96 | }); |
| 97 | group.bench_functionrust-analyzer cargo criterion 0.5.1 benchmark_group/impl#[`BenchmarkGroup<'a, M>`]bench_function().("match complex (regex_lite)", |b| { |
| 98 | b.iterrust-analyzer cargo criterion 0.5.1 bencher/impl#[`Bencher<'a, M>`]iter().(|| regex_lite2.is_matchrust-analyzer cargo regex-lite 0.1.7 string/impl#[Regex]is_match().(black_boxrust-analyzer cargo criterion 0.5.1 black_box().(TEXTrust-analyzer cargo wildmatch 2.6.1 TEXT.))) |
| 99 | }); |
| 100 | } |
| 101 | |
| 102 | criterion_grouprust-analyzer cargo criterion 0.5.1 macros/criterion_group!!(benchesrust-analyzer cargo wildmatch 2.6.1 benches()., compilingrust-analyzer cargo wildmatch 2.6.1 compiling()., matchingrust-analyzer cargo wildmatch 2.6.1 matching().); |
| 103 | criterion_mainrust-analyzer cargo criterion 0.5.1 macros/criterion_main!!(benchesrust-analyzer cargo wildmatch 2.6.1 benches().); |