Subject: Re: ksh bugs and behaviour questions
To: None <email@example.com>
From: James K. Lowden <firstname.lastname@example.org>
Date: 01/26/2003 14:21:41
On Sat, 25 Jan 2003 16:00:24 -0500, Roland Dowdeswell <email@example.com>
> David Laight wrote:
> >I'm surpised there is that much difference!
> >Trully odd things must be going on in ksh (I don't have bash).
> Well, yes and no. We just hacked /bin/sh to use vfork(2) rather
> than fork(2) based on this speedup. So, ksh which still uses
> fork(2) is going to be a lot slower.
I should mention my test was on NetBSD 1.4.2, definitely from the
pre-vfork era. A 1.6 Sparcstation yields very different results (with
apologies to Matthias):
$ time sh -c 'for i in $(jot 10000); do /bin/echo -n; done'
$ time ksh -c 'for i in $(jot 10000); do /bin/echo -n; done'
$ time bash -c 'for i in $(jot 10000); do /bin/echo -n; done'
My instinct is to agree with Matthias, that fork & exec don't amount to
much in the great scheme of things. But my head says no, there are many
interpretations. Here's 10,000 invocations taking bash 28 extra seconds
of CPU time. That only 1000 execs for 10 users.
Well, I hope I'm not beating a dead horse. Like David, I was surprised to
find so much difference in what I would have thought is a trivial, well