tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mksh import



,--- You/Kent (Tue, 4 Jan 2011 20:41:49 -0600) ----*
| Ksh93 has shown itself to be much more efficient than other shells.
|
| IMO mksh is not on par with ksh93 in performance

Any pointers to performance comparisons and/or test cases, for any
shells?

Thanks,

-- Alex -- alex-goncharov%comcast.net@localhost --


Below is some code that was originally a bash script
that generated a mandelbrot set. ksh93 was nearly 10x
faster executing this than bash (this was several years back).
Performance for other shells such as zsh, ash, and mksh
were significantly slower than ksh93. I have to be in surgery
at 7:30 in the morning. When I have recovered I will try and
get some numbers using this and some other scripts. In the
mean time if you would like to run this and see what you
come up with, please do.

inmandelbrot() {
   let "mag = $1 * $1 + $2 * $2"
   if [ $mag -gt "40000" ] || [ $5 -ge $6 ]; then
       echo $5
   else
       let âr = ($1 * $1)/100 â ($2 * $2)/100 + $3â
       let âi = ($1 * $2)/100 * 2 + $4â
       let âcnt = $5 + 1â
       inmandelbrot r i $3 $4 $cnt $6
   fi
}

for y in {-20..20}; do
   for x in {-20..20}; do
       let ârval = x * 10â
       let âival = y * 10â
       val=$(inmandelbrot rval ival rval ival 1 10)
       if [ $val -eq 10 ]; then
           echo -n â.â;
       else
           echo -n $val;
       fi
   done
   echo
done

Home | Main Index | Thread Index | Old Index