Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!deimos.cis.ksu.edu!unmvax!ncar!boulder!stan!dce From: dce@Solbourne.COM (David Elliott) Newsgroups: comp.unix.wizards Subject: while true (was Re: Must UNIX be a memory hog?) Keywords: TZ, uucp LCK... files Message-ID: <1197@marvin.Solbourne.COM> Date: 19 May 89 17:14:57 GMT References: <159@zebra.UUCP> <1608@auspex.auspex.com> <2@minya.UUCP> Reply-To: dce@Solbourne.com (David Elliott) Organization: Solbourne Computer Inc., Longmont, Colorado Lines: 23 In article <2@minya.UUCP> jc@minya.UUCP (John Chambers) writes: >On this system, as on several others, I've replaced /bin/true and /bin/false >with executables (which will be left as an exercise for the reader, since >posting them would be an intellectual insult to any True Unix Wizards ;-). >I've verified that the result is a measurable speedup in "while true" >loops, due to the elimination of the shell startup to run an empty script. >But this isn't much of a big deal, since such loops are rather rare. I don't know about "rather rare", since I have a number of big shell scripts that use "infinite" while loops. The simplest speedup is to use a builtin command that returns true; specifically ":". In other words, the fastest "while true" loop is actually while : do ... done -- David Elliott dce@Solbourne.COM ...!{boulder,nbires,sun}!stan!dce