Re:Unix V5, OpenBSD, Plan 9, FreeBSD, and GNU implementation...
by dchest on Wednesday July 20, 2011 @08:07AM
(#2785120)
This was actually the reason for FreeBSD's more complicated version. Revision 106835:
Put echo on a diet, removing unnecessary use of stdio and getopt.
Before...
-r-xr-xr-x 1 root wheel 58636 Oct 28 05:16 /bin/echo
After...
-rwxr-xr-x 1 root wheel 12824 Nov 12 17:39 /usr/obj/usr/src/bin/echo/echo
http://svnweb.freebsd.org/base?view=revision&revision=10...
My earliest UNIX programming was in the mid-80s on a machine with a (luxurious!) 1.5MB of RAM. I definitely remember avoiding stdio when writing small utilities that I wanted to start up and run fast.
Also remember that back in those days echo was not a shell builtin. (Hell, back then the testing operator '[' wasn't even a builtin. Some UNIXes like OS/X still have a vestigial /bin/[ executable!) Programs like echo that ran from shell scripts constantly had to be coded to start up as fast as possible.