Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!rochester!ken From: ken@rochester.ARPA (Ken Yap) Newsgroups: comp.sources.d Subject: Re: shell printf - a sensible solution Message-ID: <26094@rochester.ARPA> Date: Wed, 18-Mar-87 20:43:21 EST Article-I.D.: rocheste.26094 Posted: Wed Mar 18 20:43:21 1987 Date-Received: Fri, 20-Mar-87 03:17:52 EST References: <5008@brl-adm.ARPA> <210@quacky.mips.UUCP> Reply-To: ken@rochester.UUCP (Ken Yap) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 22 Summary: not for a trivial program, it ain't |With machine speed increasing all of the time, this argument is |becoming obsolete. Until we all have 20% of a 5 mips machine, it's Jon Bentley, in one of the programming pearls columns asks the reader to consider how much CPU time is saved compared to programmer time. I would guess the posted printf took more time to write than all the CPU time it will save throughout its entire lifetime. |On the other hand, there is another type of waste involved, and there |is an issue of portability. Which is why I won't use getopt in shell scripts even though it is tempting - I can't be sure it exists on every machine the shell script will be run on. Yes, there is a tradeoff, but the need has to be well documented before turning a shell script into C code. I think it was Rob Pike who noted that "ls | mc" where mc is a multi-column filter actually runs faster than the Berkeley "ls". I hate it everytime I do a "rsh ls" and forget to append -C! Ken