Subject: Re: ksh bugs and behaviour questions
To: None <firstname.lastname@example.org>
From: Matthias Buelow <email@example.com>
Date: 01/27/2003 23:03:40
James K. Lowden wrote:
> 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'
> real 1m23.455s
> user 0m2.387s
> sys 0m19.027s
> $ time ksh -c 'for i in $(jot 10000); do /bin/echo -n; done'
> real 2m0.303s
> user 0m6.465s
> sys 0m34.900s
> 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
> understood process.
Just for the records, here are the results on 1.5.1/vax (VS3100/30):
$ time sh -c 'for i in $(jot 10000); do /bin/echo -n; done'
750.57s real 28.81s user 446.79s system
$ time ksh -c 'for i in $(jot 10000); do /bin/echo -n; done'
1020.66s real 66.55s user 715.14s system
I agree that on slow systems (like this one) there is indeed a
significant difference. Although it is my understanding that few
scripts are as bare-bones as the above, executing just a tight loop with
a rather no-op echo in it; most scripts are doing much more stuff and
hence a script which does 10000 exec/forks with serious workloads on
real data probably will run for hours anyways [which makes the extra 5
minutes that ksh takes vs. sh appear in a very relative light again --
if a script is running for 5 hours, I don't really care if it takes 5
minutes longer.] Still it shows that ksh could probably be optimized
somewhat. Whether it's really worth it, I somehow doubt.