4 ms·
> It looks like we can't outdo C nor GNU in this case. Buffering is the secret, and all the overhead incurred by the kernel throttles our memory access, pipes,
by yakubin 4y ago
> It looks like we can't outdo C nor GNU in this case. Buffering is the secret, and all the overhead incurred by the kernel throttles our memory access, pipes, pv, and redirection is enough to negate 1.5 GiB/s.
On my computer reading from /dev/zero (16.5GiB/s) is still significantly faster than piping yes (7.11GiB/s), so I'd be interested in an exploration of why that is. BPF would probably be useful here. Maybe when I find a moment, I'll write a follow-up, doing just that... unless someone else does it faster. ;)
- DonHopkins 4y agoI always thought the device minor number of /dev/zero should control which number you get, so you can also make useful devices like /dev/seven with minor number 7 for an infinite source of beeps, or /dev/newline with a minor number 10 for an infinite source of newlines, and /dev/rubout with minor number 127 for an infinite source of rubouts.
- jwilk 4y agoI see a great need for /dev/yes.