The real problem is that Ruby is so dynamic.  This is great for programmers
but gives compilers a hard time.

Naive example:

    (1 + 2)

Most languages wouldn't have any problem recognizing this as a number
addition and generating quick instructions.  Any good compiler would
precompute this as 3 and use the result in the compiled code directly.

In Ruby, the '+' is a method call on a number which could be overridden at
anytime, any number of times.  It's impossible for a compiler to predict
just what '+' is going to do from one moment to the next.  JIT has a better
chance.

You can generate bytecode but it's not going to give that much of a speed
increase, IMHO, because it would still have to be doing dynamic method
lookup etc.

--
Justin Johnson

"Nat Pryce" <nat.pryce / b13media.com> wrote in message
news:1034769293.1864.2.camel / ballsup...
> On Wed, 2002-10-16 at 02:21, Phil Tomson wrote:
> > In article <slrnaqpbo0.73l.whitton / grub.atlantic.net>,
> > Travis Whitton  <whitton / atlantic.net> wrote:
> > >There's an interesting article on IBM developerWorks about a new
program
> > >called Psyco, which hooks into the guts of Python's interpreter and
does
> > >a kind of just-in-time compilation substituting bytecode for native
machine
> > >code. Apparently, this allows python to achieve near C like speeds
without
> > >having to rewrite any code, and it sounds like a really cool project.
> > >Unfortunately, I don't care much for Python, but I do love Ruby. This
leads
> > >me to the question of whether there are any similar programs available
for
> > >Ruby. If not, would such a project be possible?
> >
> > It's an interesting idea, but first we need a bytecode interpreter.  As
it
> > stands now, Ruby is interpreted by walking an AST.
>
> Why would it not be possible to compile the AST to native code?  That's
> what a traditional compiler does, after all.
>
> Cheers,
> Nat.
>
> --
> Dr. Nathaniel Pryce, Technical Director, B13media Ltd.
> Studio 3a, 22-24 Highbury Grove, London N5 2EA, UK
> http://www.b13media.com
>
>
>