Skip to content

MagLev surprises me

October 17, 2010

Monty Williams reached out to me after that last post to see whether I’d done similar experimentation with MagLev.  The answer was an embarrassing “no,” since I really haven’t kept up on MagLev development.  Last time I looked at it, I couldn’t get it to do much of anything with my existing apps, and sort of set it aside.

Monty tells me it still has these limitations:

  • It’ll run Rails 3, but not Rails 2
  • No C extensions yet

OK, but I do have some things I can try outside of those restrictions.  At the very least, in memory of poor Benoît, we can fire up the Mandelbrot … great Caesar’s ghost!

Jeez.  MagLev r24407 just turned in the 1000-iteration bench in half the time of any other Ruby I’ve tried so far.

rob@hurricane:~$ time ruby mandelbrot.rb 1000 > mandelbrot-maglev.out
real	0m10.238s
user	0m8.630s
sys	0m1.010s

Did it actually work?  I better check the image.  Yep, that looks like a Mandelbrot set.  Am I using the same computer?  Sure am.  Still singleprocessing on one of the 2 cores?  Yep.

Looks like the topaz vm knows its stuff.  On the 16000×16000 render, MagLev lands here:

rob@hurricane:~$ time ruby mandelbrot.rb 16000 > mandelbrot-maglev.out
real	41m29.750s
user	37m7.030s
sys	3m39.320s

… again, consistently halving the time of the other Rubies.  That’s almost a Python time! Still the worst on the board, but progress.  Since Monty says they haven’t done any special performance tuning, I can only assume that the battle-tested GemStone VM is just getting out of its own way pretty efficiently.

I’m really impressed by this, and several other short benchmarks I tried.  MagLev always smokes the other Rubies.

I’m still pondering what exactly to do with the MagLev alpha, though.

For now, I do still need cext support or easy alternatives like JRuby has.  Despite my best efforts, all my projects use extensions.  To port just about any Ruby project to MagLev, looks like I’ve got hours of work in store.

Before I sign up for that or start looking at the source, I need to get over my IP-phobia. Since this is a commercial product now under the VMWare banner, I’m not sure about the intellectual property underlying MagLev and its patent and trademark issues.  In the trail of GemStone acquisitions over the last couple years, I’m lost as to who holds the IP rights and what licenses and patent grants are really available for the whole stack.  If anyone reading this knows (Monty?), please post a comment pointing me to where I can educate myself properly.  Googling failed me.

Anyway, assuming I get past the cext limitation and IP paranoia, the real reason to play with MagLev isn’t the 2x benchmark gain.  It’s the free pony.

The free pony of which I speak is a robust and mature object persistence layer, with all the appropriate acronym and buzzword compliance to warm the hearts of cold, loveless IT decision-makers.

MagLev’s raison d’être is to create a Ruby environment that can leverage the GemStone object database persistence layer.  This layer is something I’ve only ever heard rave reviews about (e.g. from Randal Schwartz), but really just haven’t actually tried.  Like much about MagLev, it’s a Smalltalk thing, and I’ve never worked in Smalltalk.  Why not?  Lack of acute peer pressure.  I just don’t travel in the right circles.

By contrast, there’s stuff like MongoDB, which I’m actually using in production now, mainly because all the cool kids were doing it.  Yes, Mom, I know.

You know what else is cool?  Saying “rvm use maglev” to cheat on benchmarks.  Thanks for the suggestion, Monty!

From → Technology

7 Comments
  1. Can you show the times for the other Rubies (“any other Ruby I’ve tried so far”)?

    Thanks
    nic

  2. It should be more about the pony than performance. To quote @headius: “JRuby, Rubinius, IronRuby, MacRuby, Maglev all have a role to play.”

    We’ve finally decided to bite the bullet and enable C extensions in MagLev. It’s not trivial, so don’t expect anything soon. The C FFI just wouldn’t do everything people needed 😦

    As to IP, the MagLev code on GitHub is MIT licensed. Of course it still depends on the GemStone VM, which is 100% owned by VMware.

    We’d be glad to talk more about the pony at RubyConf next month. Hope to see you there.

    — Monty

  3. Nic, I was referring to my previous post here: https://rfc2616.wordpress.com/2010/10/16/rubinius-vs-the-benchmark-from-hell/

    The source of the Mandelbrot bench is the “Computer Language Benchmarks Game” on Alioth: http://shootout.alioth.debian.org/ I think JRuby and MRI 1.9 (YARV, KRI) are fully represented in the stats there. MRI 1.8 seems to have disappeared and I don’t think Rubinius or MagLev are tracked. If there’s interest, maybe we can get them added to the shootout, or repeat the metric elsewhere on a Rubies-specific grid.

    Monty, I have to miss RubyConf this year due to some other travel. But I hope to catch you at some other event soon! Thanks for the comment and the clarification.

  4. Isaac Gouy permalink

    >> “Computer Language Benchmarks Game” … MRI 1.8 seems to have disappeared

    Ummm no – it’s still listed on the homepage you linked to and here’s the link to the mandelbrot program

    http://shootout.alioth.debian.org/u32/program.php?test=mandelbrot&lang=ruby

  5. Isaac Gouy permalink

    >> It’s no longer included in the summaries for each bench

    Yes it is – http://shootout.alioth.debian.org/u32/performance.php?test=mandelbrot

    Look at the homepage.

    Find the row with “Ruby MRI”

    Look at the columns.

    >> Le sigh.

    Which is why, for years, it’s only been measured on – x86 one core – it’s too much of a pain to do more than that.

Leave a comment