Skip to content

Conversation

@CrazyRoka
Copy link
Contributor

Profiling revealed that shuf -i spents approximately 45% of execution time in write!(). The write! macro incurs significant overhead due to string formatting logic.

This commit replaces the standard library formatting with a manual integer to string conversion. This avoids heap allocations and locking overhead

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 4, 2026

CodSpeed Performance Report

Merging #10048 will improve performance by 40.31%

Comparing CrazyRoka:shuf-optimize-printing (5ed3d02) with main (8cf88cd)

Summary

⚡ 1 improvement
✅ 138 untouched
⏩ 37 skipped1

Benchmarks breakdown

Benchmark BASE HEAD Efficiency
shuf_input_range[1000000] 229.4 ms 163.5 ms +40.31%

Footnotes

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

@CrazyRoka CrazyRoka marked this pull request as ready for review January 4, 2026 12:52
@sylvestre
Copy link
Contributor

Merging #10048 will improve performance by 40.31%

Indeed!

@sylvestre sylvestre merged commit dc4abbb into uutils:main Jan 4, 2026
131 checks passed
@CrazyRoka CrazyRoka deleted the shuf-optimize-printing branch January 4, 2026 13:43
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