File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -55,6 +55,30 @@ 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+
69+ #[ bench]
70+ fn bench_path_file_name ( b : & mut test:: Bencher ) {
71+ let p1 = Path :: new ( "foo.bar" ) ;
72+ let p2 = Path :: new ( "foo/bar" ) ;
73+ let p3 = Path :: new ( "/bar" ) ;
74+
75+ b. iter ( || {
76+ black_box ( black_box ( p1) . file_name ( ) ) ;
77+ black_box ( black_box ( p2) . file_name ( ) ) ;
78+ black_box ( black_box ( p3) . file_name ( ) ) ;
79+ } )
80+ }
81+
5882#[ bench]
5983#[ cfg_attr( miri, ignore) ] // Miri isn't fast...
6084fn bench_path_hashset ( b : & mut test:: Bencher ) {
You can’t perform that action at this time.
0 commit comments