Subject: Re: ksh bugs and behaviour questions
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@NetBSD.ORG>
From: Matthias Buelow <mkb@mukappabeta.de>
List: tech-userlevel
Date: 01/25/2003 23:57:56
Greg A. Woods wrote:

> Lots of people still run slower machines, and there are lots of
> fairly intensive shell scripts in NetBSD, such as /etc/rc et al.
> Try booting a 4MB 386/16MHz to full multi-user mode some day!  ;-)

I'm relying heavily on a ~11MHz VAXstation running NetBSD (mostly for 
mail, but with a bit more than 4 megs RAM, of course) so I think I know 
what I'm talking about... both sh and ksh scripts are very slow on that 
machine, but everything is, no matter if some micro-optimizations are 
applied, or not.  Maybe they'll run a tiny fraction faster but it'll 
still be slow as hell, and it'll not matter at all in the "grand scheme".

> You have to start somewhere and when some simple loop like this
> identifies really interesting differences in performance with different
> interpreter implementations, then you may already have made a really
> good start!

What differences!  A second or two in 10000 iterations!  That's 
marginal, it's negligible.  If at all, the programs should be profiled 
first, with typical workloads running, and then be talked about.  OTOH, 
both sh and pdksh (aswell as bash) exhibit typical runtime performance 
as observed for most sh-interpreters (unless you take the SysV Bourne sh 
into account, which is much slower because it doesn't have as many 
builtins), so don't hold your breath.  There do exist some sh/ksh 
compilers producing executable files, if you really need faster sh 
scripts (I'd rather classify those as "workarounds" tho, than as proper 
solutions because if you arrive at some point where you need to compile 
sh scripts, you're probably not using the right language.)

-- 
Matthias Buelow