Skip to content

Commit dccbf42

Browse files
committed
benchmark path.components() iteration
1 parent 2cb4e7d commit dccbf42

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

library/std/benches/path.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ fn bench_path_cmp_fast_path_short(b: &mut test::Bencher) {
5555
});
5656
}
5757

58+
#[bench]
59+
fn bench_path_components_iter(b: &mut test::Bencher) {
60+
let p = Path::new("/my/home/is/my/castle/and/my/castle/has/a/rusty/workbench/");
61+
62+
b.iter(|| {
63+
for c in black_box(p).components() {
64+
black_box(c);
65+
}
66+
})
67+
}
68+
5869
#[bench]
5970
#[cfg_attr(miri, ignore)] // Miri isn't fast...
6071
fn bench_path_hashset(b: &mut test::Bencher) {

0 commit comments

Comments
 (0)