tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: mksh import
>I ran your script on various systems; very impressive, both for
>performance and portability reasons. ksh93 is beginning to win my
>heart (although it's not a portable as bash, in this case.)
>
>Below is the summary:
I noticed that several of the shells croaked while trying to execute the
script. I know that I had some troubles with the 'let' and '{-20..20}' features
(among a couple others). I've slightly rewritten that script to make it run on
NetBSD's /bin/sh -- so it should be highly portable (I think). Here is the
results from running on NetBSD 5.1 with /bin/sh:
==================================
NetBSD: /bin/sh
real 0.87
user 0.40
sys 0.46
inmandelbrot() {
mag=$(($1 * $1 + $2 * $2))
if [ $mag -gt "40000" ] || [ $5 -ge $6 ]; then
echo $5
else
r=$((($1 * $1)/100 - ($2 * $2)/100 + $3))
i=$((($1 * $2)/100 * 2 + $4))
cnt=$(($5 + 1))
inmandelbrot r i $3 $4 $cnt $6
fi
}
for y in `seq -20 20`; do
for x in `seq -20 20`; do
rval=$((x * 10))
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
--
Christopher Berardi
http://www.natoufa.com/
Be still, and know that I am God (Psalms 46:10)
Home |
Main Index |
Thread Index |
Old Index