Re:Yes-rs: A fast, memory-safe rewrite of the classic Unix y...
by forgotpwd16 on Tuesday May 27, 2025 @04:50AM
(#44105104)
Replace `write(..)` with `puts("y")` and you'll be an order of magnitude faster. This is due to `puts` (`printf` too) being buffered (data isn't written to term/file immediately but retained in memory until some point). Improving this process (as seen in the reddit thread) gets GNU-yes.
[ Parent
| on HN ]
Re:Yes-rs: A fast, memory-safe rewrite of the classic Unix y...
by GoblinSlayer on Tuesday May 27, 2025 @05:01AM
(#44105158)
It's line buffered when it prints to terminal.
Re:Yes-rs: A fast, memory-safe rewrite of the classic Unix y...
by jesprenj on Tuesday May 27, 2025 @07:38AM
(#44105923)
One rarely needs yes' output to be a terminal.
Re:Yes-rs: A fast, memory-safe rewrite of the classic Unix y...
by throwawaymaths on Tuesday May 27, 2025 @05:35AM
(#44105347)
Don't you actively want it to flush asap since you're usually piping into another program?
I suspect what you suggest creates a more voluminous dump but is slower in the desired use case