dce@Solbourne.COM (David Elliott) (05/20/89)
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
jas@ernie.Berkeley.EDU (Jim Shankland) (05/20/89)
In article <1197@marvin.Solbourne.COM> dce@Solbourne.com (David Elliott) writes: >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 Right; that's how I code my "while true" loops. But what I haven't figured out is: how do I optimize my "while false" loops? Jim Shankland jas@ernie.berkeley.edu "Blame it on the lies that killed us, blame it on the truth that ran us down"
john@trigraph.UUCP (John Chew) (05/22/89)
In article <29237@ucbvax.BERKELEY.EDU> jas@ernie.Berkeley.EDU (Jim Shankland) writes: [ while : ; do ... ; done ] >Right; that's how I code my "while true" loops. But what I haven't figured >out is: how do I optimize my "while false" loops? Gee, that's obvious... you use an "until :" loop. :-) John -- john j. chew, iii phone: +1 416 425 3818 AppleLink: CDA0329 trigraph, inc., toronto, canada {uunet!utai!utcsri,utgpu,utzoo}!trigraph!john dept. of math., u. of toronto poslfit@{utorgpu.bitnet,gpu.utcs.utoronto.ca}