From 53980774c327675e886179c0a2c140744dcf9b95 Mon Sep 17 00:00:00 2001 From: Jonas Maier Date: Sat, 6 Jun 2026 12:15:52 +0200 Subject: special cased regex for performance --- benches/regex.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'benches') 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); }) }); }; -- cgit v1.2.3