Skip to content

Commit 35fe773

Browse files
committed
bench(shuf): add short average line length benchmarks
1 parent 9d502ec commit 35fe773

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/uu/shuf/benches/shuf_bench.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ use uucore::benchmark::{run_util_function, setup_test_file, text_data};
99

1010
/// Benchmark shuffling lines from a file
1111
/// Tests the default mode with a large number of lines
12-
#[divan::bench(args = [100_000])]
13-
fn shuf_lines(bencher: Bencher, num_lines: usize) {
14-
let data = text_data::generate_by_lines(num_lines, 80);
12+
#[divan::bench(args = [(100_000, 80), (100_000, 10)])]
13+
fn shuf_lines(bencher: Bencher, (num_lines, avg_line_length): (usize, usize)) {
14+
let data = text_data::generate_by_lines(num_lines, avg_line_length);
1515
let file_path = setup_test_file(&data);
1616
let file_path_str = file_path.to_str().unwrap();
1717

@@ -33,12 +33,12 @@ fn shuf_input_range(bencher: Bencher, range_size: usize) {
3333

3434
/// Benchmark shuffling with repeat (sampling with replacement)
3535
/// Tests the -r flag combined with -n to output a specific count
36-
#[divan::bench(args = [50_000])]
37-
fn shuf_repeat_sampling(bencher: Bencher, num_lines: usize) {
38-
let data = text_data::generate_by_lines(10_000, 80);
36+
#[divan::bench(args = [(50_000, 80), (50_000, 10)])]
37+
fn shuf_repeat_sampling(bencher: Bencher, (head_count, avg_line_length): (usize, usize)) {
38+
let data = text_data::generate_by_lines(10_000, avg_line_length);
3939
let file_path = setup_test_file(&data);
4040
let file_path_str = file_path.to_str().unwrap();
41-
let count = format!("{num_lines}");
41+
let count = format!("{head_count}");
4242

4343
bencher.bench(|| {
4444
black_box(run_util_function(

0 commit comments

Comments
 (0)