@@ -61,17 +61,33 @@ fn du_human_balanced_tree(
6161/// Benchmark du on wide directory structures (many files/dirs, shallow)
6262#[ divan:: bench( args = [ ( 5000 , 500 ) ] ) ]
6363fn du_wide_tree ( bencher : Bencher , ( total_files, total_dirs) : ( usize , usize ) ) {
64- let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
65- fs_tree:: create_wide_tree ( temp_dir. path ( ) , total_files, total_dirs) ;
66- bench_du_with_args ( bencher, & temp_dir, & [ ] ) ;
64+ bencher
65+ . with_inputs ( || {
66+ let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
67+ fs_tree:: create_wide_tree ( temp_dir. path ( ) , total_files, total_dirs) ;
68+ temp_dir
69+ } )
70+ . bench_values ( |temp_dir| {
71+ let temp_path_str = temp_dir. path ( ) . to_str ( ) . unwrap ( ) ;
72+ let args = vec ! [ temp_path_str] ;
73+ black_box ( run_util_function ( uumain, & args) ) ;
74+ } ) ;
6775}
6876
6977/// Benchmark du -a on wide directory structures
7078#[ divan:: bench( args = [ ( 5000 , 500 ) ] ) ]
7179fn du_all_wide_tree ( bencher : Bencher , ( total_files, total_dirs) : ( usize , usize ) ) {
72- let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
73- fs_tree:: create_wide_tree ( temp_dir. path ( ) , total_files, total_dirs) ;
74- bench_du_with_args ( bencher, & temp_dir, & [ "-a" ] ) ;
80+ bencher
81+ . with_inputs ( || {
82+ let temp_dir = TempDir :: new ( ) . unwrap ( ) ;
83+ fs_tree:: create_wide_tree ( temp_dir. path ( ) , total_files, total_dirs) ;
84+ temp_dir
85+ } )
86+ . bench_values ( |temp_dir| {
87+ let temp_path_str = temp_dir. path ( ) . to_str ( ) . unwrap ( ) ;
88+ let args = vec ! [ temp_path_str, "-a" ] ;
89+ black_box ( run_util_function ( uumain, & args) ) ;
90+ } ) ;
7591}
7692
7793/// Benchmark du on deep directory structures
0 commit comments