MagLev handles trees like a monkey

Over the past couple of nights, I tried out MagLev on my Mac laptop (Mac OS X Leopard, 2.2GHz, 2GB Ram). While the shootout will provide us with a detailed comparison between MagLev and the other major Ruby implementations (on many tests) I thought I’d share my first impressions.

MagLev is going to be a fast implementation of Ruby. How many times faster? Well, it depends on the test, and I don’t have systematic numbers yet to come up with a geometric mean of the ratios (the shootout will do just that). What I can tell you now though, is that it’s fast, significantly faster than MRI. You know that slowness that you’ve almost come to expect when running a Ruby script? It’s simply not there with MagLev. And let’s not forget, that MagLev’s added value is not limited to performance, in the same way that JRuby’s integration with Java is a strong selling point.

It’s not mature, of course, and there are a few things which haven’t been implemented yet. But it’s complete enough to run WEBrick and several other small programs I tried. A truly impressive accomplishment if you think about what was achieved in just three months. So let me reassure you that it’s not vaporware, it’s real and it’s fast.

I want to leave you with an example of a non-trivial benchmark. Running the binary-trees test from the Computer Language Benchmarks Game (chosen because it’s the first test), I obtained the following results:

PHP 5.2.5 100.603s
Perl 5.8.8 70.885s
Ruby 1.8.6 60.089s
Python 2.5.1 29.908s
MagLev 7.673s
C++ (gcc 4.0.1) 6.265s

Aside from being much faster than Ruby 1.8.6, MagLev’s speed is pretty darn close to that of the extremely fast C++ (complied with g++ and all the optimizations), in this specific case.

You can’t read too much from a single test, especially when we are not comparing different VMs from the same identical script like we’ll do for the shootout. It’s impressive nevertheless and it should give you a hint about MagLev’s speed even when facing non-trivial, non-ad-hoc benchmarks.

Get more stuff like this

Subscribe to my mailing list to receive similar updates about programming.

Thank you for subscribing. Please check your email to confirm your subscription.

Something went wrong.


  1. Norlan Mumar June 5, 2008
  2. Daniel Luz June 5, 2008
  3. Ralf June 5, 2008
  4. Andy Keep June 5, 2008
  5. Charles Oliver Nutter June 5, 2008
  6. Pingback: Patrick Collison » blog June 5, 2008
  7. JeanHuguesRobert June 5, 2008
  8. seydar June 5, 2008
  9. Antonio Cangiano June 5, 2008
  10. Ilya Grigorik June 5, 2008
  11. Markus Kohler June 6, 2008
  12. mtkd June 6, 2008
  13. Antonio Cangiano June 6, 2008
  14. Charles June 6, 2008
  15. Antonio Cangiano June 6, 2008
  16. Jon Yurek June 6, 2008
  17. AkitaOnRails June 6, 2008
  18. Danno Ferrin June 6, 2008
  19. Antonio Cangiano June 6, 2008
  20. Mauricio June 6, 2008
  21. Clarence Odbody June 6, 2008
  22. Chris Hulbert June 6, 2008
  23. Victor June 6, 2008
  24. Victor June 6, 2008
  25. Adam Greene June 6, 2008
  26. Robert Hulme June 9, 2008
  27. Luis Eduardo Bohrer June 10, 2008
  28. Antonio Cangiano June 10, 2008
  29. Kyle June 13, 2008
  30. Robert Hulme June 18, 2008
  31. Jason June 18, 2008

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.