diff options
author | Canop <cano.petrole@gmail.com> | 2020-05-24 21:41:18 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-05-24 21:41:18 +0200 |
commit | f52403e47d14a71d2428c020c63541cfe296afe5 (patch) | |
tree | b9d93c425790ba6dfa85d2fd97f9504de8738467 /benches | |
parent | bda58cd490ac415b75eaae0b3cd35bc3c0369dc8 (diff) |
tab based auto-completion of verbs and paths in input
Diffstat (limited to 'benches')
-rw-r--r-- | benches/path_normalization.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/benches/path_normalization.rs b/benches/path_normalization.rs new file mode 100644 index 0000000..38b586d --- /dev/null +++ b/benches/path_normalization.rs @@ -0,0 +1,36 @@ +use { + broot::path, + criterion::{black_box, criterion_group, criterion_main, Criterion}, +}; + +static PATHS: &[&str] = &[ + "/abc/test/../thing.png", + "/abc/def/../../thing.png", + "/home/dys/test", + "/home/dys", + "/home/dys/", + "/home/dys/..", + "/home/dys/../", + "/..", + "../test", + "/home/dys/../../../test", + "/a/b/c/d/e/f/g/h/i/j/k/l/m/n", + "/a/b/c/d/e/f/g/h/i/j/k/l/m/n/", + "/", + "π/2", +]; + + +fn normalization_benchmark(c: &mut Criterion) { + c.bench_function("normalize_path", |b| { + b.iter(|| { + for path in PATHS { + black_box(path::normalize_path(path)); + } + }); + }); +} + +criterion_group!(benches, normalization_benchmark); +criterion_main!(benches); + |