
Compiling Ruby: From Text to Bytecode - swombat
http://www.engineyard.com/blog/2009/the-anatomy-of-a-ruby-jit-compile/
======
peregrine
I've only ever been exposed to this a few times, so this is pretty cool. I've
always been interested in compiler design.

Here is a question, is the 'slowness' of ruby because of its
compiler/interpreter or is it because of its language design?

~~~
steveklabnik
It's a combination of both, actually. From what I understand, Matz is more of
a dreams guy than an implementations guy. He made MRI work, but never really
intended it to be fast or efficient. This is why 1.9 is a totally different
compiler; Matz can go back to designing, and others can worry about
implementations

There's also quite a bit of Ruby that's non-trivial to compile. For instance,
think about method_missing. If a message gets sent to an object, a naive
implementation would have to check every parent class up the inheretance
chain, and then do it all over again to see if a method_missing is defined,
too. That's quite a bit of time. Also, things like open classes make things
like caching hard, as well.

None of these problems are insurmountable, but they take some work and some
effort. Luckily, Ruby has those people now.

~~~
ionfish
This is also why things like the double-inclusion problem are still live
issues.

<http://eigenclass.org/hiki/The+double+inclusion+problem>

One problem that Ruby does need to deal with is when implementation problems
become institutionalised as language specifications.

[http://blog.jcoglan.com/2009/06/06/when-bugs-become-
features...](http://blog.jcoglan.com/2009/06/06/when-bugs-become-features/)

------
abdels
Wow, Rubinius that's certainly a blast from the past. Its great that the
project is still ongoing.

I especially like the link at the bottom of the post to the Rubinius book tour
<http://bit.ly/1wVU4> aka what you can read to fully understand or design a
Rubinius.

Faster speed is always good. However, my interest in Rubinius is more of a
learning thing. Its really cool to be able to check the implementation of
class 'Class' <http://bit.ly/fCyIw> when you need to or fully understand how
some underlying algorithms implemented in the language are put together in
just plain old Ruby code (not C).

