A little story about the `yes` Unix command
I always enjoy reading these kinds of write ups digging into why something is as fast as it is and how it interacts with a wider system. However, I do think that one should not arrive at the belief that this kind of optimisation is warranted everywhere and that code simplicity can also be a goal. The classic argument is to compare OpenBSD’s yes [1] to GNU coreutils’ yes [2] and contemplate on under which circumstances those additional MB/s of “y” will be critical enough to warrant the maintenance of more than one hundred additional lines.[1]: https://cvsweb.openbsd.org/src/usr.bin/yes/yes.c?rev=1.9&con...[2]: https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/yes...Similarly, there is the NSFW comparison between Plan 9’s cat and GNU coreutils’ cat [3].[3]: http://9front.org/img/longcat.pngJust to reiterate in the end though. This is not an argument against optimisation and learning how to make something blazingly fast. But, there is such a thing as optimising the wrong thing and using speed as the only justification for merging a patch is probably not the right thing to do for a bigger project.