[comp.unix.wizards] Is sh script faster than csh script ?

lee@iris.Ucdavis.EDU (Peng Lee) (09/11/89)

------------------------
137 % cat iput
#!/bin/sh
#
#  intelligent put
#
case $# in
[01])   echo "Usage: $0 host filename [dis directory]";;
*)      host="$1"; shift
        user=`nfrh $host`
        rcp -r "$1" "$host"."$user":"$*" &
esac

138 % cat iput.c
#!/bin/csh
#
#  intelligent put ( csh script )
#

set user=`~/bin/nfrh $1`
rcp -r "$2" "$1"."$user":. &

139 % time iput bloom iput
0.0u 0.1s 0:00 73% 24+12k 0+0io 0pf+0w
140 % time iput.c bloom iput.c
[1] 26361
1.9u 1.5s 0:05 68% 136+85k 11+17io 2pf+0w
141 %
-------------------------
It seems that csh used a lot more memory, io, and had 2 pages fault.

Would any unix.wizards out there explain why csh is so slow?  Or did I
use the wrong command in the script?   

This test is done VAX. 

Peng (lee@iris.ucdavis.edu)

amos@taux01.UUCP (Amos Shapir) (09/12/89)

In article <5292@ucdavis.ucdavis.edu> lee@iris.Ucdavis.EDU (Peng Lee) writes:
>It seems that csh used a lot more memory, io, and had 2 pages fault.
>
>Would any unix.wizards out there explain why csh is so slow?  Or did I
>use the wrong command in the script?   

If your .cshrc is big, it might slow things down considerably - it's read
on every sub-shell.

-- 
	Amos Shapir		amos@taux01.nsc.com or amos@nsc.nsc.com
National Semiconductor (Israel) P.O.B. 3007, Herzlia 46104, Israel
Tel. +972 52 522261  TWX: 33691, fax: +972-52-558322
34 48 E / 32 10 N			(My other cpu is a NS32532)

jeffm@uokmax.UUCP (Jeff Medcalf) (09/13/89)

In article <2555@taux01.UUCP> amos@taux01.UUCP (Amos Shapir) writes:
>
>If your .cshrc is big, it might slow things down considerably - it's read
>on every sub-shell.
>
>-- 
>	Amos Shapir		amos@taux01.nsc.com or amos@nsc.nsc.com


In order to prevent this, use csh -f (e.g. #!/bin/csh -f).  All that this does
is to prevent the reading of the .cshrc file (and of course any files sourced
by .cshrc, such as the .alias file that many people (at this site, at least)
use).  However, sh will still be faster.


-- 
jeffm@uokmax.UUCP   |  Arkansas state motto:  At Least We're Not Oklahoma.  |
Jeff Medcalf	+-----------------------------------------------------------+
----------------|       Artificial Intelligence?  As opposed to what?	    |
                +-----------------------------------------------------------+