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

Skip to content

Commit 28bc57a

Browse files
authored
Merge pull request #9030 from sylvestre/remove-bench
bench: remove 'sort_random_strings'
2 parents 552c386 + d26ff97 commit 28bc57a

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

src/uu/sort/benches/sort_locale_bench.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -129,26 +129,6 @@ fn sort_german_locale(bencher: Bencher) {
129129
});
130130
}
131131

132-
/// Benchmark random strings of different lengths
133-
#[divan::bench]
134-
fn sort_random_strings(bencher: Bencher) {
135-
let data = text_data::generate_random_strings(50_000, 50);
136-
let file_path = setup_test_file(&data);
137-
// Reuse the same output file across iterations to reduce filesystem variance
138-
let output_file = NamedTempFile::new().unwrap();
139-
let output_path = output_file.path().to_str().unwrap().to_string();
140-
141-
bencher.bench(|| {
142-
unsafe {
143-
env::set_var("LC_ALL", "en_US.UTF-8");
144-
}
145-
black_box(run_util_function(
146-
uumain,
147-
&["-o", &output_path, file_path.to_str().unwrap()],
148-
));
149-
});
150-
}
151-
152132
/// Benchmark numeric sorting performance
153133
#[divan::bench]
154134
fn sort_numeric(bencher: Bencher) {

src/uucore/src/lib/features/benchmark.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -280,25 +280,6 @@ pub mod text_data {
280280
generate_data_from_words_simple(&base_words, num_lines)
281281
}
282282

283-
/// Generate random strings with mixed charset including accented characters
284-
pub fn generate_random_strings(num_lines: usize, length: usize) -> Vec<u8> {
285-
let mut data = Vec::new();
286-
let charset =
287-
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789äöüÄÖÜßéèêëàâîïôûç";
288-
let charset_bytes = charset.as_bytes();
289-
290-
for i in 0..num_lines {
291-
let mut line = String::new();
292-
for j in 0..length {
293-
let idx = ((i * length + j) * 17 + 42) % charset_bytes.len();
294-
line.push(charset_bytes[idx] as char);
295-
}
296-
line.push('\n');
297-
data.extend_from_slice(line.as_bytes());
298-
}
299-
data
300-
}
301-
302283
/// Generate numeric data for benchmarking (simple sequential numbers)
303284
pub fn generate_numbers(count: usize) -> String {
304285
(1..=count)

0 commit comments

Comments
 (0)