Skip to content

wc: add a UTF-8 character-count benchmark - #15202

Merged
sylvestre merged 2 commits into
uutils:mainfrom
darkraider01:wc-utf8-benchmark
Oct 9, 2026
Merged

sylvestre merged 2 commits into
uutils:mainfrom
darkraider01:wc-utf8-benchmark

Conversation

@darkraider01

Copy link
Copy Markdown
Contributor

The existing character-count benchmark uses ASCII input. Add a UTF-8 case with two-, three-, and four-byte characters, plus instructions for running it in a UTF-8 locale.

Split from #15139 and #15140 as requested in #15140 (comment).

}

#[divan::bench(args = [100_000])]
fn wc_chars_utf8(bencher: Bencher, num_lines: usize) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please set LC_ALL in the bench itself, like join_bench.rs or sort_locale_utf8_bench.rs?
codspeed won't use the env from the doc

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Comment thread src/uu/wc/benches/wc_bench.rs Outdated
let file_path = create_test_file(data.as_bytes(), temp_dir.path());

bencher
.with_inputs(|| get_bench_args(&[&"-cm", &file_path]).into_iter())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why -cm and not just -m like wc_chars_large_line_count?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thankyou

@codspeed

codspeed Bot commented Oct 9, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 14.95%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 2 improved benchmarks
❌ 1 regressed benchmark
✅ 396 untouched benchmarks
🆕 2 new benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation three_39_bit_primes 438.2 ms 761.9 ms -42.49%
⚡ Simulation five_38_bit_primes 1.9 s 1.8 s +3.83%
⚡ Simulation thirteen_39_bit_primes 9.1 s 8.8 s +3.04%
🆕 Memory wc_chars_utf8[100000] N/A 16.6 KB N/A
🆕 Simulation wc_chars_utf8[100000] N/A 767.1 µs N/A

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing darkraider01:wc-utf8-benchmark (9d308ce) with main (33a2889)

Open in CodSpeed

Footnotes

  1. 54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@sylvestre
sylvestre merged commit 6b35c0b into uutils:main Oct 9, 2026
188 of 189 checks passed
@sylvestre

Copy link
Copy Markdown
Contributor

Thanks for your PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants