Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cbbd265

Browse files
committed
bench(dd): increase dataset sizes for consistent timing
Increase benchmark dataset sizes to achieve consistent 100-300ms timing: - dd_copy_default: 16 -> 32 MB - dd_copy_4k_blocks: 16 -> 24 MB - dd_copy_64k_blocks: 16 -> 64 MB - dd_copy_1m_blocks: 16 -> 128 MB - dd_copy_separate_blocks: 16 -> 48 MB - dd_copy_partial: 16 -> 32 MB - dd_copy_with_skip: 16 -> 48 MB - dd_copy_with_seek: 16 -> 48 MB - dd_copy_8k_blocks: 16 -> 32 MB This ensures stable, repeatable benchmark measurements across different systems.
1 parent a8082ad commit cbbd265

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/uu/dd/benches/dd_bench.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ fn remove_file(path: &Path) {
2525
}
2626

2727
/// Benchmark basic dd copy with default settings
28-
#[divan::bench(args = [16])]
28+
#[divan::bench(args = [32])]
2929
fn dd_copy_default(bencher: Bencher, size_mb: usize) {
3030
let temp_dir = TempDir::new().unwrap();
3131
let input = temp_dir.path().join("input.bin");
@@ -50,7 +50,7 @@ fn dd_copy_default(bencher: Bencher, size_mb: usize) {
5050
}
5151

5252
/// Benchmark dd copy with 4KB block size (common page size)
53-
#[divan::bench(args = [16])]
53+
#[divan::bench(args = [24])]
5454
fn dd_copy_4k_blocks(bencher: Bencher, size_mb: usize) {
5555
let temp_dir = TempDir::new().unwrap();
5656
let input = temp_dir.path().join("input.bin");
@@ -76,7 +76,7 @@ fn dd_copy_4k_blocks(bencher: Bencher, size_mb: usize) {
7676
}
7777

7878
/// Benchmark dd copy with 64KB block size
79-
#[divan::bench(args = [16])]
79+
#[divan::bench(args = [64])]
8080
fn dd_copy_64k_blocks(bencher: Bencher, size_mb: usize) {
8181
let temp_dir = TempDir::new().unwrap();
8282
let input = temp_dir.path().join("input.bin");
@@ -102,7 +102,7 @@ fn dd_copy_64k_blocks(bencher: Bencher, size_mb: usize) {
102102
}
103103

104104
/// Benchmark dd copy with 1MB block size
105-
#[divan::bench(args = [16])]
105+
#[divan::bench(args = [128])]
106106
fn dd_copy_1m_blocks(bencher: Bencher, size_mb: usize) {
107107
let temp_dir = TempDir::new().unwrap();
108108
let input = temp_dir.path().join("input.bin");
@@ -128,7 +128,7 @@ fn dd_copy_1m_blocks(bencher: Bencher, size_mb: usize) {
128128
}
129129

130130
/// Benchmark dd copy with separate input and output block sizes
131-
#[divan::bench(args = [16])]
131+
#[divan::bench(args = [48])]
132132
fn dd_copy_separate_blocks(bencher: Bencher, size_mb: usize) {
133133
let temp_dir = TempDir::new().unwrap();
134134
let input = temp_dir.path().join("input.bin");
@@ -155,7 +155,7 @@ fn dd_copy_separate_blocks(bencher: Bencher, size_mb: usize) {
155155
}
156156

157157
/// Benchmark dd with count limit (partial copy)
158-
#[divan::bench(args = [16])]
158+
#[divan::bench(args = [32])]
159159
fn dd_copy_partial(bencher: Bencher, size_mb: usize) {
160160
let temp_dir = TempDir::new().unwrap();
161161
let input = temp_dir.path().join("input.bin");
@@ -182,7 +182,7 @@ fn dd_copy_partial(bencher: Bencher, size_mb: usize) {
182182
}
183183

184184
/// Benchmark dd with skip (seeking in input)
185-
#[divan::bench(args = [16])]
185+
#[divan::bench(args = [48])]
186186
fn dd_copy_with_skip(bencher: Bencher, size_mb: usize) {
187187
let temp_dir = TempDir::new().unwrap();
188188
let input = temp_dir.path().join("input.bin");
@@ -209,7 +209,7 @@ fn dd_copy_with_skip(bencher: Bencher, size_mb: usize) {
209209
}
210210

211211
/// Benchmark dd with seek (seeking in output)
212-
#[divan::bench(args = [16])]
212+
#[divan::bench(args = [48])]
213213
fn dd_copy_with_seek(bencher: Bencher, size_mb: usize) {
214214
let temp_dir = TempDir::new().unwrap();
215215
let input = temp_dir.path().join("input.bin");
@@ -236,7 +236,7 @@ fn dd_copy_with_seek(bencher: Bencher, size_mb: usize) {
236236
}
237237

238238
/// Benchmark dd with different block sizes for comparison
239-
#[divan::bench(args = [16])]
239+
#[divan::bench(args = [32])]
240240
fn dd_copy_8k_blocks(bencher: Bencher, size_mb: usize) {
241241
let temp_dir = TempDir::new().unwrap();
242242
let input = temp_dir.path().join("input.bin");

0 commit comments

Comments
 (0)