diff options
| author | Jonas Maier <jonas@x77.dev> | 2026-06-06 12:15:52 +0200 |
|---|---|---|
| committer | Jonas Maier <jonas@x77.dev> | 2026-06-06 12:15:52 +0200 |
| commit | 53980774c327675e886179c0a2c140744dcf9b95 (patch) | |
| tree | ca1fdcc9938fce2c10c51e0a51659c6ba38ac5ba /benches/regex.rs | |
| parent | 75e0c29cf91ddc6299c14a94a038c3e3df3d2805 (diff) | |
| download | pish-53980774c327675e886179c0a2c140744dcf9b95.tar.gz | |
special cased regex for performance
Diffstat (limited to 'benches/regex.rs')
| -rw-r--r-- | benches/regex.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/benches/regex.rs b/benches/regex.rs index 577e44d..dd8f54a 100644 --- a/benches/regex.rs +++ b/benches/regex.rs @@ -1,8 +1,6 @@ use criterion::{Criterion, Throughput, criterion_group, criterion_main}; -use pish::parse::{ - Parse, - regex::{Pattern, bc::BytecodeCompiledRegex}, -}; +use pish::parse::Parse; +use pish::regex::{Pattern, RegexEngine}; /// https://mattmahoney.net/dc/enwik8.zip pub fn regex_throughput(c: &mut Criterion) { @@ -14,11 +12,11 @@ pub fn regex_throughput(c: &mut Criterion) { let mut re = |re: &str| { let pat = Pattern::parse_from_bytes(re.as_bytes()).unwrap(); - let compiled = BytecodeCompiledRegex::try_from(pat).unwrap(); + let compiled = pat.try_compile().unwrap(); group.bench_function(&format!("enwik6 {re}"), |b| { b.iter(|| { - let _ = compiled.re_match(&content); + compiled.matches(&content); }) }); }; |
