Skip to content

Add wax to benchmark #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ glob = "0.3.2"
globset = "0.4.15"
glob-match = "0.2.1"
criterion2 = { version = "3.0.0", default-features = false }
wax = "0.6.0"

[features]
default = []
Expand Down
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,14 @@ const PATH: &'static str = "some/a/bigger/path/to/the/crazy/needle.txt";
```

```
mine time: [87.185 ns 87.307 ns 87.440 ns]
glob time: [376.83 ns 377.42 ns 378.09 ns]
globset time: [21.027 µs 21.035 µs 21.045 µs]
glob_match time: [203.66 ns 203.87 ns 204.09 ns]
glob_pre_compiled time: [63.569 ns 63.684 ns 63.800 ns]
globset_pre_compiled time: [91.543 ns 91.591 ns 91.651 ns]
mine time: [84.413 ns 84.548 ns 84.661 ns]
glob time: [398.63 ns 399.36 ns 400.10 ns]
globset time: [30.919 µs 30.942 µs 30.976 µs]
glob_match time: [224.16 ns 224.57 ns 225.03 ns]
glob_pre_compiled time: [78.929 ns 79.362 ns 79.801 ns]
globset_pre_compiled time: [103.17 ns 103.22 ns 103.27 ns]
wax time: [84.712 µs 84.831 µs 84.953 µs]
wax-pre-compiled time: [43.661 ns 43.679 ns 43.701 ns]
```

### Test Case 2
Expand All @@ -58,10 +60,12 @@ const PATH: &'static str = "some/a/bigger/path/to/the/crazy/needle.txt";
```

```
mine time: [198.63 ns 199.26 ns 200.08 ns]
globset time: [41.489 µs 41.575 µs 41.681 µs]
glob_match time: [367.32 ns 368.10 ns 368.77 ns]
globset_pre_compiled time: [91.498 ns 91.648 ns 91.883 ns]
mine time: [188.01 ns 188.40 ns 188.79 ns]
globset time: [38.565 µs 38.684 µs 38.841 µs]
glob_match time: [381.81 ns 383.12 ns 384.43 ns]
globset_pre_compiled time: [103.29 ns 103.35 ns 103.42 ns]
wax time: [107.04 µs 107.38 µs 107.78 µs]
wax-pre-compiled time: [43.665 ns 43.764 ns 43.918 ns]
```

## FAQ
Expand Down
15 changes: 15 additions & 0 deletions benches/bench.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use criterion::{criterion_group, criterion_main, Criterion};
use wax::Pattern;

fn simple_match(c: &mut Criterion) {
let mut group = c.benchmark_group("simple_match");
Expand Down Expand Up @@ -28,6 +29,13 @@ fn simple_match(c: &mut Criterion) {

group.bench_function("fast-glob", |b| b.iter(|| fast_glob::glob_match(GLOB, PATH)));

group.bench_function("wax", |b| b.iter(|| wax::Glob::new(GLOB).unwrap().is_match(PATH)));

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

group.finish();
}

Expand All @@ -52,6 +60,13 @@ fn brace_expansion(c: &mut Criterion) {
b.iter(|| fast_glob::glob_match(GLOB, PATH));
});

group.bench_function("wax", |b| b.iter(|| wax::Glob::new(GLOB).unwrap().is_match(PATH)));

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

group.finish();
}

Expand Down
Loading