File: path_normalization.rs

package info (click to toggle)
rust-broot 1.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,928 kB
  • sloc: makefile: 20
file content (36 lines) | stat: -rw-r--r-- 679 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use {
    broot::path,
    glassbench::*,
};

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 bench_normalization(gb: &mut Bench) {
    gb.task("normalize_path", |b| {
        b.iter(|| {
            for path in PATHS {
                pretend_used(path::normalize_path(path));
            }
        });
    });
}

glassbench!(
    "Path Normalization",
    bench_normalization,
);