4 ms·
Because BSDs don't use the GNU userland? As to why they don't use similar techniques, probably because they historically didn't really care enough about the pe
by masklinn 4y ago
Because BSDs don't use the GNU userland?
As to why they don't use similar techniques, probably because they historically didn't really care enough about the performances of yes(1) to bother with it.
FreeBSD has since added output buffering to yes(1), you can see the difference between openbsd yes(1)[0] which remains utterly naïve and freebsd yes(1)[1] which uses an 8k internal buffer.
[0]: https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c https://github.com/openbsd/src/blob/master/usr.bin/yes/yes.c
[1]: https://svnweb.freebsd.org/base/head/usr.bin/yes/yes.c?view=markup https://svnweb.freebsd.org/base/head/usr.bin/yes/yes.c?view=...
- mtlmtlmtlmtl 4y agoAmusingly, the OpenBSD one remains completely naïve, but still uses pledge for privilege dropping.
- midislack 4y agoIt's not naive, it's correct. GNU's focus is on features, kitchen sink style, performance tuning, etc. If that's what you want, it's for you. OpenBSD is focused on correctness. It's not correct to use hacks and buffering in tools to increase performance. That should be handled at the syscall interface or in the kernel or whatever.
- dizzant 4y agoCan you expand on why you think performance hacking degrades correctness? As I understand it, “yes” (with no arguments) is supposed to output “y\n” continuously until terminated. Throughout/latency are unspecified, admitting various implementations with various concerns, like GNU’s focus on throughout vs BSD’s focus on latency/simplicity. Even an implementation that took 10 seconds between each output could be desirable for some use cases! Is that version of “yes” less correct?
- guenthert 4y agoThe case can be made that, given that kernel code tends to be more difficult to write and debug and is inherently security critical, there ought to be less of it. If the buffering can be generalized then it ought to be in a library to be shared, otherwise the application is the right place.