Newsgroups: comp.bugs.sys5 Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Shell Scripts v. Command Options (was: Re: small bug in who(1) of SVR3) Message-ID: <1991Jan16.175908.3338@zoo.toronto.edu> Organization: U of Toronto Zoology References: <18899@rpp386.cactus.org> <1991Jan14.202053.20054@zoo.toronto.edu> <18946@rpp386.cactus.org> Date: Wed, 16 Jan 1991 17:59:08 GMT In article <18946@rpp386.cactus.org> jfh@rpp386.cactus.org (John F Haugh II) writes: >Studies have shown that the cost of maintaining code is largely independent >of the language and depends primarily on the amount of code. A three line >change to a C file should be just as easy to maintain as a three line shell >script. (a) These are not three-line changes. (b) Three lines of C *in the context of a much larger program* are a great deal harder to maintain than a three-line shell script which interacts with nothing but itself. >As for performance, benchmarks will indicate the fork() is an extremely >expensive system call... The question is not whether it costs a lot, but whether it is worth the cost. >If you have more than 68 users on your system and it only forks 68 times >per second, you are likely to find that shell scripts run pretty damned >slow... Only if your users can type at least one command a second, which is rare. I have no idea what the fork rate on our system is -- although being a Sun, it's probably damnably slow -- but it's enough for our not-notably-patient user community. A user who's sitting in a text editor or waiting for a sort to finish doesn't care about the fork rate. A user who's running "who" or a variant thereon usually doesn't either. I don't advocate callous disregard for efficiency -- that way lies GNU Emacs and other excesses -- but a sense of perspective is needed. Hacking C code to avoid writing a one-line shell script is a gross waste of time and money unless that program is truly critical to system performance. -- If the Space Shuttle was the answer, | Henry Spencer at U of Toronto Zoology what was the question? | henry@zoo.toronto.edu utzoo!henry