Skip to content

basenc: buffer base16 encoded output - #13885

Open
myunbin wants to merge 1 commit into
uutils:mainfrom
myunbin:basenc-bufwriter-32k
Open

basenc: buffer base16 encoded output#13885
myunbin wants to merge 1 commit into
uutils:mainfrom
myunbin:basenc-bufwriter-32k

Conversation

@myunbin

@myunbin myunbin commented Aug 12, 2026

Copy link
Copy Markdown

Base16 encoding currently writes output in small chunks(~2 KiB).
Buffer these writes with a 32 KiB BufWriter to reduce the number of write system calls.

Output Before After
/dev/null 12.049 ms 11.048 ms (-8.3%)
Regular file 25.853 ms 20.406 ms (-21.1%)

@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 31.56%

⚠️ 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

⚡ 1 improved benchmark
❌ 5 regressed benchmarks
✅ 341 untouched benchmarks
🆕 10 new benchmarks
⏩ 46 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory b64_decode_ignore_garbage_synthetic 12.1 KB 36.1 KB -66.46%
Memory b64_decode_synthetic 12.1 KB 36.1 KB -66.46%
Simulation du_max_depth_balanced_tree[(6, 4, 10)] 62.1 ms 65.2 ms -4.75%
Simulation du_summarize_balanced_tree[(5, 4, 10)] 16 ms 16.7 ms -4.23%
Simulation numfmt_large_numbers_si[10000] 94.7 ms 98.1 ms -3.4%
Simulation complex_relative_date 330.2 µs 318.6 µs +3.65%
🆕 Memory ptx_input_references_short_lines[100000] N/A 222.2 MB N/A
🆕 Memory ptx_long_lines[100] N/A 29.5 MB N/A
🆕 Memory ptx_short_lines[100000] N/A 240.1 MB N/A
🆕 Memory ptx_input_references_long_lines[1000] N/A 29.1 MB N/A
🆕 Memory ptx_tex[10000] N/A 20.6 MB N/A
🆕 Simulation ptx_input_references_short_lines[100000] N/A 16.2 s N/A
🆕 Simulation ptx_long_lines[100] N/A 1.7 s N/A
🆕 Simulation ptx_short_lines[100000] N/A 14 s N/A
🆕 Simulation ptx_input_references_long_lines[1000] N/A 2.1 s N/A
🆕 Simulation ptx_tex[10000] N/A 2.9 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 myunbin:basenc-bufwriter-32k (6196f97) with main (66cf72b)2

Open in CodSpeed

Footnotes

  1. 46 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.

  2. No successful run was found on main (e6561b5) during the generation of this report, so 66cf72b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Comment thread src/uu/base32/src/base_common.rs Outdated

// Fixed to 8 KiB (equivalent to `std::sys::io::DEFAULT_BUF_SIZE` on most targets)
pub const DEFAULT_BUF_SIZE: usize = 8 * 1024;
const BASE16_OUTPUT_BUFFER_SIZE: usize = 32 * 1024;

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.

Can we align DEFAULT_BUF_SIZE to same size too?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Aligned DEFAULT_BUF_SIZE to 32 KiB as well. Thanks!

@myunbin
myunbin force-pushed the basenc-bufwriter-32k branch from 4e52388 to 6196f97 Compare August 12, 2026 06:35
@myunbin myunbin closed this Aug 13, 2026
@myunbin myunbin reopened this Aug 13, 2026
@sylvestre

Copy link
Copy Markdown
Contributor

In a new pr, could you please add a new benchmark covering these cases? Thanks

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/date/resolution (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/pr/bounded-memory (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tail/symlink (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/dd/no-allocate is now passing!

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.

3 participants