Shell performance (sh, ksh, & csh).

Shell performance (sh, ksh, & csh).

Post by David Smi » Sat, 22 Jun 1991 06:37:55



I had a question regarding the various shells performance.  In "The Korn Shell
Command and Programming Language", by Bolsky and Korn it is stated:

"In spite of its increased size, ksh provides better performance.  Programs
can be written to run faster with ksh than with either Bourne shell or the C
shell, sometimes an order of magnitude faster."

Does anyone have some good examples of this statement?  I know doing arithmetic
now in the ksh is much better because it is builtin, but what about in general?

Responses may be posted or e-mailed to me directly.  I will post a summary of
the responses.

Thank you,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  David W. Smith                                All comments made are my own
  NASA Ames Research Center                     and do not in anyway reflect
  M/S 233-3                                     NASA opinions or policies.
  Moffett Field, CA 94035-1000
  (415) 604-6555


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 
 
 

Shell performance (sh, ksh, & csh).

Post by Bernd Felsc » Sun, 23 Jun 1991 17:18:17




Quote:>"In spite of its increased size, ksh provides better performance.  Programs
>can be written to run faster with ksh than with either Bourne shell or the C
>shell, sometimes an order of magnitude faster."
>Does anyone have some good examples of this statement?  I know doing arithmetic
>now in the ksh is much better because it is builtin, but what about in general?

In general, ksh is slower starting, but faster executing. If you have
shell scripts with only one non-builtin command, then the Bourne shell
will very probably run it faster and more efficiently.

If your machine is tight on memory, then the Korn shell is more likely
to have part of it paged out under heavy load, slowing it down in
comparison to the smaller Bourne shell. Murphy's Law of memory
management states that the next page needed by a process is to be
paged out to make room for another EMACS :-)

The Korn shell, when used properly, can run a lot faster as it has
more builtins. Careful programming in the Bourne shell can achieve
almost the same result. Applying the same practices to the Korn shell
does not generally achieve the same spectacular performance
improvements.

Shell performance is IMHO a function of the programmer.
--
Bernd Felsche,                 _--_|\   #include <std/disclaimer.h>
Metapro Systems,              / sold \  Fax:   +61 9 472 3337
328 Albany Highway,           \_.--._/  Phone: +61 9 362 9355