From f52403e47d14a71d2428c020c63541cfe296afe5 Mon Sep 17 00:00:00 2001 From: Canop Date: Sun, 24 May 2020 21:41:18 +0200 Subject: tab based auto-completion of verbs and paths in input --- benches/path_normalization.rs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 benches/path_normalization.rs (limited to 'benches') 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); + -- cgit v1.2.3