Skip to content

Commit

Permalink
chore: add pre compiled benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Dav1dde committed Aug 13, 2024
1 parent 4e9778f commit 10636a2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ fn simple_match(c: &mut Criterion) {
b.iter(|| assert!(glob::Pattern::new(GLOB).unwrap().matches(PATH)))
});

group.bench_function("glob-pre-compiled", |b| {
let matcher = glob::Pattern::new(GLOB).unwrap();
b.iter(|| assert!(matcher.matches(PATH)))
});

group.bench_function("globset", |b| {
b.iter(|| {
assert!(globset::Glob::new(GLOB)
Expand All @@ -19,6 +24,11 @@ fn simple_match(c: &mut Criterion) {
})
});

group.bench_function("globset-pre-compiled", |b| {
let matcher = globset::Glob::new(GLOB).unwrap().compile_matcher();
b.iter(|| assert!(matcher.is_match(PATH)))
});

group.bench_function("glob-match", |b| {
b.iter(|| assert!(glob_match::glob_match(GLOB, PATH)))
});
Expand All @@ -45,6 +55,11 @@ fn brace_expansion(c: &mut Criterion) {
})
});

group.bench_function("globset-pre-compiled", |b| {
let matcher = globset::Glob::new(GLOB).unwrap().compile_matcher();
b.iter(|| assert!(matcher.is_match(PATH)))
});

group.bench_function("glob-match", |b| {
b.iter(|| assert!(glob_match::glob_match(GLOB, PATH)))
});
Expand Down

0 comments on commit 10636a2

Please sign in to comment.