Comment by collinfunk
15 days ago
The rationale is explained in this 2015 commit: https://github.com/coreutils/coreutils/commit/35217221c211f3...
The current implementation is much faster than in that commit on GNU/Linux, as documented in this 2026 commit: https://github.com/coreutils/coreutils/commit/2b1c059e6a06ee...
The OpenBSD implementation is much slower than both the GNU versions from 2015 and 2026. However, their goals are different from ours, and that statement should not be interpreted as criticism of theirs.
The 99% use case is for just `yes` though. That is optimized for such a niche corner-case...
What downsides does it have for end users?
It makes the code way less auditable and more prone to bugs and errors. Or let the kernel change its paging mechanism and now your fucking “yes” tool needs an update to be “efficient”. The tool has one job…print yes or another word you give it. It by definition does not have to optimized to oblivion. Same goes for echo.
It’s arsinine to optimize it to that level instead of just keeping it readable and maintainable. And portable.
The gnu version is 100% not easily portable because it has assumptions about the underlying kernel.
3 replies →
What can go wrong with allocating memory based on user input….I wonder….