tech-userlevel archive

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

Re: mksh import



,--- Dad - Kent - <pobox0123%hotmail.com@localhost> (Tue, 4 Jan 2011 22:27:22 
-0600) ----*
| 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 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:

============================================================
FreeBSD 8.2-PRERELEASE
== /bin/sh ==>
let: arithmetic expression: variable conversion error: "rval = x * 10"
let: arithmetic expression: variable conversion error: "ival = y * 10"
[: 0: unexpected operator

real    0m0.003s
user    0m0.000s
sys     0m0.004s
<== /bin/sh ===

== /usr/local/bin/bash ==>

real    0m1.591s
user    0m0.927s
sys     0m0.813s
<== /usr/local/bin/bash ===

== /usr/local/bin/ksh ==>
./mandelbrot.sh[45]: {-20..20}: unexpected `{'

real    0m0.001s
user    0m0.001s
sys     0m0.000s
<== /usr/local/bin/ksh ===

== /usr/local/bin/ksh93 ==>

real    0m0.274s
user    0m0.280s
sys     0m0.000s
<== /usr/local/bin/ksh93 ===

============================================================
Linux 2.6.18-92.el5PAE
== /bin/bash ==>

real    0m2.369s
user    0m1.379s
sys     0m0.967s
<== /bin/bash ===

== /bin/zsh ==>
./mandelbrot.sh:35: bad math expression: illegal character: {
./mandelbrot.sh:36: bad math expression: illegal character: {

real    0m0.086s
user    0m0.002s
sys     0m0.006s
<== /bin/zsh ===

== /bin/ksh ==>

real    0m0.253s
user    0m0.249s
sys     0m0.003s
<== /bin/ksh ===

============================================================

SunOS 5.10 
== /bin/bash ==>

real    0m5.449s
user    0m1.676s
sys     0m2.662s
<== /bin/bash ===

== /bin/sh ==>
./mandelbrot.sh: syntax error at line 37: `val=$' unexpected

real    0m0.009s
user    0m0.001s
sys     0m0.005s
<== /bin/sh ===

== /bin/ksh ==>
./mandelbrot.sh[35]: {-20..20}: syntax error
./mandelbrot.sh[36]: {-20..20}: syntax error
./mandelbrot.sh: mag = rval * rval + ival * ival: bad number
./mandelbrot.sh[5]: r = (rval * rval)/100 - (ival * ival)/100 + rval: bad number
./mandelbrot.sh[6]: i = (rval * ival)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number

real    0m0.010s
user    0m0.003s
sys     0m0.005s
<== /bin/ksh ===

============================================================
AIX 3 5
== /bin/bash ==>

real    0m2.102s
user    0m1.206s
sys     0m0.335s
<== /bin/bash ===

== /bin/ksh ==>
./mandelbrot.sh[35]: {-20..20}: syntax error
./mandelbrot.sh[36]: {-20..20}: syntax error
./mandelbrot.sh: mag = rval * rval + ival * ival: bad number
./mandelbrot.sh[5]: r = (rval * rval)/100 - (ival * ival)/100 + rval: bad number
./mandelbrot.sh[6]: i = (rval * ival)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number
./mandelbrot.sh[5]: r = (r * r)/100 - (i * i)/100 + rval: bad number
./mandelbrot.sh[6]: i = (r * i)/100 * 2 + ival: bad number

real    0m0.008s
user    0m0.003s
sys     0m0.003s
<== /bin/ksh ===

== /bin/ksh93 ==>
./mandelbrot.sh[35]: let: {-20..20}: arithmetic syntax error
./mandelbrot.sh[36]: let: {-20..20}: arithmetic syntax error

real    0m0.005s
user    0m0.002s
sys     0m0.001s
<== /bin/ksh93 ===

== /bin/bsh ==>
./mandelbrot.sh: syntax error at line 37: `val=$' unexpected

real    0m0.038s
user    0m0.001s
sys     0m0.001s
<== /bin/bsh ===

============================================================

Thanks,

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


Home | Main Index | Thread Index | Old Index