A little story about the `yes` Unix command
I always enjoy reading these kinds of write ups digging into <i>why</i> 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.<p>[1]: <a href="https://cvsweb.openbsd.org/src/usr.bin/yes/yes.c?rev=1.9&content-type=text/x-cvsweb-markup" rel="nofollow">https://cvsweb.openbsd.org/src/usr.bin/yes/yes.c?rev=1.9&con...</a><p>[2]: <a href="https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/yes.c" rel="nofollow">https://git.savannah.gnu.org/cgit/coreutils.git/tree/src/yes...</a><p>Similarly, there is the NSFW comparison between Plan 9’s cat and GNU coreutils’ cat [3].<p>[3]: <a href="http://9front.org/img/longcat.png" rel="nofollow">http://9front.org/img/longcat.png</a><p>Just 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.