Hi, Rubyists!

I recently buried in my announcement for the new version
of ratlast, some info that may be of more general interest.
So, I thought I'd change the format and resend it.  I hope
you don't mind too much.

I have also done a little bit of benchmarking of native Ruby
and ratlast, the FORTH interpreter as a Ruby extension.  To do
these benchmarks, I have taken some of the code posted on Doug Bagely's
Language Shootout site (http://www.bagley.org/~doug/shootout).

I looked at three examples where Ruby performed rather
poorly:
Sieve of Eratosthenes,
Random Number, and
Array Access.

In each of theses tests, Ruby came in down the list.  By running
the FORTH versions through ratlast (following the same rules, not
using idiomatic code ;-) ), I am seeing a speedup factor of between
5 to 7 times.

Here are the results:

\begin{code}

$ruby bench_1.rb Count (Ruby) 100 iterations: 1028 Count (ratlast) 100 iterations: 1028 Random (ruby) 100000 iterations: 56.568644262 Random (ratlast) 100000 iterations: 56.568600000 Random (ruby) 1000 iterations: y[0]=1000 y[last]=1000000 Random (ratlast) 1000 iterations: y[0]=1000 y[last]=1000000 -------------------------------------------------- BenchTimer Report: -------------------------------------------------- Array Access (ratlast) 0.56s Array Access (ruby) 2.14s Random Number (ratlast) 0.12s Random Number (ruby) 0.73s Sieve of Eratosthenes (ratlast) 0.64s Sieve of Eratosthenes (ruby) 4.08s --------------------------------------------------$ ruby -v
ruby 1.7.3 (2002-11-17) [i386-mswin32]

\end{code}

I have yet to check the speed increase if I were to do
these benchmarks in C as extensions.  I suspect that I
would see another x5 or so, though it is very nice to have
half this speed without having to compile any additional
C code.

bytecode interpreters, I would suggest these figures show
what can be done just using fairly straight forward TIL
techniques.  The ratlast system is not very big or complicated
(around 5k lines with glue).  A more sophisticated embedded
interpreter/compiler could see much greater gains.

If you have any questions or suggestions, please feel free
to email or post to this group.

-mark.