Skip to content

Commit 4f5e665

Browse files
committed
benchmark: don't pass the args in the divan function
1 parent 98910ff commit 4f5e665

File tree

1 file changed

+27
-18
lines changed

1 file changed

+27
-18
lines changed

src/uu/dd/benches/dd_bench.rs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ use uu_dd::uumain;
99
use uucore::benchmark::{binary_data, fs_utils, run_util_function};
1010

1111
/// Benchmark basic dd copy with default settings
12-
#[divan::bench(args = [32])]
13-
fn dd_copy_default(bencher: Bencher, size_mb: usize) {
12+
#[divan::bench]
13+
fn dd_copy_default(bencher: Bencher) {
14+
let size_mb = 32;
1415
let temp_dir = TempDir::new().unwrap();
1516
let input = temp_dir.path().join("input.bin");
1617
let output = temp_dir.path().join("output.bin");
@@ -34,8 +35,9 @@ fn dd_copy_default(bencher: Bencher, size_mb: usize) {
3435
}
3536

3637
/// Benchmark dd copy with 4KB block size (common page size)
37-
#[divan::bench(args = [24])]
38-
fn dd_copy_4k_blocks(bencher: Bencher, size_mb: usize) {
38+
#[divan::bench]
39+
fn dd_copy_4k_blocks(bencher: Bencher) {
40+
let size_mb = 24;
3941
let temp_dir = TempDir::new().unwrap();
4042
let input = temp_dir.path().join("input.bin");
4143
let output = temp_dir.path().join("output.bin");
@@ -60,8 +62,9 @@ fn dd_copy_4k_blocks(bencher: Bencher, size_mb: usize) {
6062
}
6163

6264
/// Benchmark dd copy with 64KB block size
63-
#[divan::bench(args = [64])]
64-
fn dd_copy_64k_blocks(bencher: Bencher, size_mb: usize) {
65+
#[divan::bench]
66+
fn dd_copy_64k_blocks(bencher: Bencher) {
67+
let size_mb = 64;
6568
let temp_dir = TempDir::new().unwrap();
6669
let input = temp_dir.path().join("input.bin");
6770
let output = temp_dir.path().join("output.bin");
@@ -86,8 +89,9 @@ fn dd_copy_64k_blocks(bencher: Bencher, size_mb: usize) {
8689
}
8790

8891
/// Benchmark dd copy with 1MB block size
89-
#[divan::bench(args = [128])]
90-
fn dd_copy_1m_blocks(bencher: Bencher, size_mb: usize) {
92+
#[divan::bench]
93+
fn dd_copy_1m_blocks(bencher: Bencher) {
94+
let size_mb = 128;
9195
let temp_dir = TempDir::new().unwrap();
9296
let input = temp_dir.path().join("input.bin");
9397
let output = temp_dir.path().join("output.bin");
@@ -112,8 +116,9 @@ fn dd_copy_1m_blocks(bencher: Bencher, size_mb: usize) {
112116
}
113117

114118
/// Benchmark dd copy with separate input and output block sizes
115-
#[divan::bench(args = [48])]
116-
fn dd_copy_separate_blocks(bencher: Bencher, size_mb: usize) {
119+
#[divan::bench]
120+
fn dd_copy_separate_blocks(bencher: Bencher) {
121+
let size_mb = 48;
117122
let temp_dir = TempDir::new().unwrap();
118123
let input = temp_dir.path().join("input.bin");
119124
let output = temp_dir.path().join("output.bin");
@@ -139,8 +144,9 @@ fn dd_copy_separate_blocks(bencher: Bencher, size_mb: usize) {
139144
}
140145

141146
/// Benchmark dd with count limit (partial copy)
142-
#[divan::bench(args = [32])]
143-
fn dd_copy_partial(bencher: Bencher, size_mb: usize) {
147+
#[divan::bench]
148+
fn dd_copy_partial(bencher: Bencher) {
149+
let size_mb = 32;
144150
let temp_dir = TempDir::new().unwrap();
145151
let input = temp_dir.path().join("input.bin");
146152
let output = temp_dir.path().join("output.bin");
@@ -166,8 +172,9 @@ fn dd_copy_partial(bencher: Bencher, size_mb: usize) {
166172
}
167173

168174
/// Benchmark dd with skip (seeking in input)
169-
#[divan::bench(args = [48])]
170-
fn dd_copy_with_skip(bencher: Bencher, size_mb: usize) {
175+
#[divan::bench]
176+
fn dd_copy_with_skip(bencher: Bencher) {
177+
let size_mb = 48;
171178
let temp_dir = TempDir::new().unwrap();
172179
let input = temp_dir.path().join("input.bin");
173180
let output = temp_dir.path().join("output.bin");
@@ -193,8 +200,9 @@ fn dd_copy_with_skip(bencher: Bencher, size_mb: usize) {
193200
}
194201

195202
/// Benchmark dd with seek (seeking in output)
196-
#[divan::bench(args = [48])]
197-
fn dd_copy_with_seek(bencher: Bencher, size_mb: usize) {
203+
#[divan::bench]
204+
fn dd_copy_with_seek(bencher: Bencher) {
205+
let size_mb = 48;
198206
let temp_dir = TempDir::new().unwrap();
199207
let input = temp_dir.path().join("input.bin");
200208
let output = temp_dir.path().join("output.bin");
@@ -220,8 +228,9 @@ fn dd_copy_with_seek(bencher: Bencher, size_mb: usize) {
220228
}
221229

222230
/// Benchmark dd with different block sizes for comparison
223-
#[divan::bench(args = [32])]
224-
fn dd_copy_8k_blocks(bencher: Bencher, size_mb: usize) {
231+
#[divan::bench]
232+
fn dd_copy_8k_blocks(bencher: Bencher) {
233+
let size_mb = 32;
225234
let temp_dir = TempDir::new().unwrap();
226235
let input = temp_dir.path().join("input.bin");
227236
let output = temp_dir.path().join("output.bin");

0 commit comments

Comments
 (0)