From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14105 invoked from network); 23 Apr 1998 20:50:31 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 23 Apr 1998 20:50:31 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id QAA19658; Thu, 23 Apr 1998 16:46:28 -0400 (EDT) Resent-Date: Thu, 23 Apr 1998 16:46:28 -0400 (EDT) Message-ID: <19980423154613.A1788@emsphone.com> Date: Thu, 23 Apr 1998 15:46:13 -0500 From: Dan Nelson To: Nik Gervae , zsh-workers@math.gatech.edu Subject: Re: System calls in zsh References: <199804231945.MAA07509@wank.pdi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.92.1i In-Reply-To: <199804231945.MAA07509@wank.pdi.com>; from "Nik Gervae" on Thu Apr 23 12:45:23 GMT 1998 X-OS: FreeBSD 2.2.6-STABLE Resent-Message-ID: <"YQ5lc2.0.2p4.ZYwFr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3868 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu In the last episode (Apr 23), Nik Gervae said: > Hello. I've been using zsh 3.0.0 on IRIX for a while here at work, > and we just started an evaluation of shell script efficiency that > prompted me to ask this. It seems that if you create an empty zsh > script and run it, it invokes these system calls (which I got using > "par -s -S"): > > exit : 1 times > read : 12 times > open : 12 times > close : 11 times [etc] > Can anyone explain why read() and open() are called so many times for > an empty shell script? The Bourne and Korn shells here invoke them > twice each. zsh seems to be expending a bit more effort here than > might be necessary. Check to see which files are being opened and read. On FreeBSD, a zsh -f -c '' opens the following: /var/run/dev.db, /dev/tty, /etc/pwd.db, /etc/zshenv, /dev/null, and takes .02 seconds from exec() to exit(). If you forgot to put a -f on your zsh commandline, it's probably reading your zprofile, zshrc, zshenv, and zshrc files.