Sat, 02 Jul 2011

How fast is Rakudo's "nom" branch?

Nearly one year ago, the Rakudo Perl 6
developers proudly released the first Rakudo Star, a
distribution aimed at showing the world what Perl 6 can look like, and in turn
get feedback from more early adaptors.

And feedback we got. While the overall response was very positive, people
had one main concern: it was too slow. That didn't come as a surprise,
considering that we had focused on features first. Now it was time to change
that, and work on massive performance improvements.

That is easier said than done. One of the reasons is that Rakudo is tightly
coupled to the parrot virtual machine, but
there is a lot of mismatch between the two. For example parrot provides multi
dispatch built-in, but not quite with the semantics that Perl 6 needs. Same
for parameter binding, objects and a number of other areas.

In the following year, parrot got a new, faster garbage collector, and
Jonathan Worthington came up with a cache for type checks at routine call
time.

This sped up this simple mandelbrot fractal
generator at size 201x201 from 18 minutes to 16 minutes 14 seconds.
Actually the speedup was better than that, but we paid a performance penalty
for new features, bug fixes and parrot performance regressions.

But it was clear that more substantial improvements where needed.
One of the most promising candidates for
speedups is a
complete redesign of the object
model, resulting in the "nom"
(new object model) branch of Rakudo. Additionally to providing much more
well suited OO primitives than parrot can offer right now, it also allows to
share more information between compile time and run time, making a lot of
optimizations possible.

Now that's a speedup by more than a factor of 5. I'm not sure if it will
extend to other operators, but it sure is encouraging.

And that's without the optimizations that will now be possible, for example
inlining operators. So after a literally slow start, Rakudo Perl 6 has a
bright and fast future ahead. And it's already here, just not evenly
distributed.