Mercurial > lbo > hg > rex
changeset 75:1e01c3c381cf
Add benchmark for notorious regex in regex crate
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Mon, 17 Feb 2020 20:41:41 +0100 |
parents | 15032c4aa33a |
children | b2214096af30 |
files | benches/e2e.rs |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/benches/e2e.rs Mon Feb 17 20:36:35 2020 +0100 +++ b/benches/e2e.rs Mon Feb 17 20:41:41 2020 +0100 @@ -35,6 +35,13 @@ }); } +fn bench_notorious_regex_crate(b: &mut Bencher) { + let re = regex::Regex::new("(x+x+)+y").unwrap(); + b.iter(|| { + assert!(re.is_match("xxxxxxxxxxy")); + }); +} + fn bench_regex_crate(b: &mut Bencher) { let re = regex::Regex::new("^(Hello)? [Ww]orld!?$").unwrap(); b.iter(|| { @@ -47,6 +54,7 @@ bench_simple_re, bench_simple_precompile, bench_notorious, + bench_notorious_regex_crate, bench_regex_crate, bench_simplest_precompile );