Skip to content

Conversation

@CrazyRoka
Copy link
Contributor

This PR addresses a performance bottleneck when processing large numbers of dates (e.g., using date -f large_file.txt).

Previously, the main loop used println!, which locks and flushes stdout on every iteration. This change wraps stdout in a BufWriter and uses writeln!, significantly improving throughput for batch operations.

@CrazyRoka CrazyRoka force-pushed the date-optimize-println branch from d6708e5 to b0afcf4 Compare January 2, 2026 21:10
@CrazyRoka CrazyRoka force-pushed the date-optimize-println branch from b0afcf4 to f0238dc Compare January 2, 2026 21:13
@CrazyRoka
Copy link
Contributor Author

Some CodSpeed benchmarks are showing ~30% performance improvement when system calls are included in the measurement (link):

image

@CrazyRoka CrazyRoka marked this pull request as ready for review January 2, 2026 21:59
@sylvestre sylvestre merged commit 3df9444 into uutils:main Jan 3, 2026
129 of 130 checks passed
@CrazyRoka CrazyRoka deleted the date-optimize-println branch January 3, 2026 18:07
sgmarz pushed a commit to sgmarz/coreutils that referenced this pull request Jan 7, 2026
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