Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/uu/df/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ uucore = { workspace = true, features = ["benchmark"] }
[target.'cfg(unix)'.dependencies]
rustix = { workspace = true, features = ["fs"] }

[target.'cfg(unix)'.dev-dependencies]
rustix = { workspace = true, features = ["stdio"] }

[lints]
workspace = true

Expand Down
33 changes: 0 additions & 33 deletions src/uu/df/benches/df_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,39 +38,6 @@ fn df_deep_directory(bencher: Bencher) {
env::set_current_dir(original_dir).unwrap();
}

#[cfg(unix)]
#[divan::bench]
fn df_with_path(bencher: Bencher) {
use rustix::stdio::dup2_stdout;
use uucore::benchmark::run_util_function;

let temp_dir = TempDir::new().unwrap();
let temp_path_str = temp_dir.path().to_str().unwrap();
let stdout_bak = rustix::io::dup(rustix::stdio::stdout()).unwrap();
let devnull = fs::OpenOptions::new()
.write(true)
.open("/dev/null")
.unwrap();

bencher.bench_local(|| {
dup2_stdout(&devnull).unwrap();
black_box(run_util_function(uumain, &[temp_path_str]));
});

dup2_stdout(&stdout_bak).unwrap();
}

#[cfg(not(unix))]
#[divan::bench]
fn df_with_path(bencher: Bencher) {
let temp_dir = TempDir::new().unwrap();
let temp_path = temp_dir.path();

bencher
.with_inputs(|| get_bench_args(&[&temp_path]).into_iter())
.bench_values(|args| black_box(uumain(args)));
}

fn main() {
divan::main();
}
15 changes: 0 additions & 15 deletions src/uu/du/benches/du_bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,6 @@ fn du_summarize_balanced_tree(
.bench_values(|args| black_box(uumain(args)));
}

/// Benchmark du with --max-depth
#[divan::bench(args = [(6, 4, 10)])]
fn du_max_depth_balanced_tree(
bencher: Bencher,
(depth, dirs_per_level, files_per_dir): (usize, usize, usize),
) {
let temp_dir = TempDir::new().unwrap();
let temp_path = temp_dir.path();
fs_tree::create_balanced_tree(temp_path, depth, dirs_per_level, files_per_dir);

bencher
.with_inputs(|| get_bench_args(&[&"--max-depth=2", &temp_path]).into_iter())
.bench_values(|args| black_box(uumain(args)));
}

fn main() {
divan::main();
}
Loading