Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: System calls in zsh



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.



Messages sorted by: Reverse Date, Date, Thread, Author