coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

base(nc|32|64): Optimize performances reduction memset

Open mattsu2020 opened this issue 2 weeks ago • 2 comments

Summary

  • Allocate read buffers with capacity and reuse their spare capacity to avoid zeroing overhead in fast encode/decode paths.
  • Switch fast encode/decode to read into spare capacity via slice::from_raw_parts_mut, keeping safety comments to document the initialization guarantees.
  • Tidy base_common.rs imports for consistency.

related https://github.com/uutils/coreutils/issues/9621

mattsu2020 avatar Dec 11 '25 12:12 mattsu2020

CodSpeed Performance Report

Merging #9632 will improve performances by 3.15%

Comparing mattsu2020:base32_performance_check (27b72b4) with main (2000af8)

Summary

⚡ 2 improvements
✅ 125 untouched
⏩ 6 skipped[^skipped]

Benchmarks breakdown

Benchmark BASE HEAD Change
b64_decode_synthetic 169.8 µs 164.6 µs +3.15%
b64_decode_ignore_garbage_synthetic 169.7 µs 164.6 µs +3.14%
[^skipped]: 6 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.

codspeed-hq[bot] avatar Dec 11 '25 12:12 codspeed-hq[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Dec 11 '25 12:12 github-actions[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Dec 12 '25 09:12 github-actions[bot]

i am not a fan of adding unsafe. would it be possible to find another way? thanks

sylvestre avatar Dec 13 '25 13:12 sylvestre

GNU testsuite comparison:

Congrats! The gnu test tests/cksum/cksum is no longer failing!

github-actions[bot] avatar Dec 13 '25 14:12 github-actions[bot]

is it ready for review?

sylvestre avatar Dec 17 '25 07:12 sylvestre

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar Dec 17 '25 09:12 github-actions[bot]