use test::Bencher;
use regex::internal::ProgramBuilder;
#[bench]
fn compile_simple(b: &mut Bencher) {
b.iter(|| {
let re = r"^bc(d|e)*$";
ProgramBuilder::new(&re).compile().unwrap()
});
}
#[bench]
fn compile_simple_bytes(b: &mut Bencher) {
b.iter(|| {
let re = r"^bc(d|e)*$";
ProgramBuilder::new(&re).bytes(true).compile().unwrap()
});
}
#[bench]
fn compile_small(b: &mut Bencher) {
b.iter(|| {
let re = r"\p{L}|\p{N}|\s|.|\d";
ProgramBuilder::new(&re).compile().unwrap()
});
}
#[bench]
fn compile_small_bytes(b: &mut Bencher) {
b.iter(|| {
let re = r"\p{L}|\p{N}|\s|.|\d";
ProgramBuilder::new(&re).bytes(true).compile().unwrap()
});
}
#[bench]
fn compile_huge(b: &mut Bencher) {
b.iter(|| {
let re = r"\p{L}{100}";
ProgramBuilder::new(&re).compile().unwrap()
});
}
#[bench]
fn compile_huge_bytes(b: &mut Bencher) {
b.iter(|| {
let re = r"\p{L}{100}";
ProgramBuilder::new(&re).bytes(true).compile().unwrap()
});
}