Table of Contents

Numbers, numbers

At RailsConf Europe I attended the presentation of Maglev which besides having an awesome built-in object database also is said to be blazingly fast. Now, a vendor performing benchmark is something to be very skeptical about, especially when they themselves supply the benchmarking code. But, damn, this thing was fast.

Anyway, just for the heck of it I downloaded the benchmark code and ran it with a collection of the four Ruby VMs I have installed on my Macbook. Which gave some very interesting results.

Rubinius

  user system total real
bm\app\answer 0.170895 0.000000 0.170895 (0.170897)
bm\app\fib 2.503374 0.000000 2.503374 (2.503459)
bm\app\tak 3.694804 0.000000 3.694804 (3.694871)
bm\app\tarai 3.464458 0.000000 3.464458 (3.464511)
bm\so\ackermann 0.174997 0.000000 0.174997 (0.174957)

Completed short yarv test

Jruby

  user system total real
bm\app\answer 1.799000 0.000000 1.799000 (1.798000)
bm\app\fib 12.791000 0.000000 12.791000 (12.791000)
bm\app\tak 16.473000 0.000000 16.473000 (16.473000)
bm\app\tarai 14.507000 0.000000 14.507000 (14.507000)
bm\so\ackermann 1.994000 0.000000 1.994000 (1.995000)

Completed short yarv test

Ruby 1.9 aka YARV

  user system total real
bm\app\answer 0.100000 0.000000 0.100000 (0.106201)
bm\app\fib 1.560000 0.020000 1.580000 (1.670600)
bm\app\tak 2.280000 0.020000 2.300000 (2.442614)
bm\app\tarai 1.620000 0.010000 1.630000 (1.706611)
bm\so\ackermann 0.100000 0.000000 0.100000 (0.104408)

Completed short yarv test

Ruby 1.8.6 aka MRI

  user system total real
bm\app\answer 1.900000 0.030000 1.930000 (2.476135)
bm\app\fib 19.550000 0.220000 19.770000 (21.336605)
bm\app\tak 24.380000 0.280000 24.660000 (26.687820)
bm\app\tarai 19.540000 0.240000 19.780000 (21.760484)
bm\so\ackermann 1.890000 0.020000 1.910000 (2.040490)

Completed short yarv test

So what does this tell us?

Apart from Maglev kicking all the other Rubies (I don't have the results of Maglev running this suite), this informal game actually ranks Rubinius as the second fastest Ruby VM available. Charles Nutter was quick in commenting on the issue on Jruby's behalf, and I'm quite sure he's right. On the presentation at RailsConf, the audience was skeptical about the choice of what to benchmark, saying that the benchmarks measure Ruby VMs on Smalltalk's home turf - silently ignoring to check the speed with which the VMs perform Ruby specific tasks.

What we can see, however is that MRI is aging; of the four VMs tested it is by far the slowest. And Rubinius isn't all that bad.

The Jruby team should see increased interest as Rails becomes thread safe in 2.2; the threading model in Jruby will give Jruby a great advantage to all the other VMs once this becomes mainstream. And Rubinius seems to be on the right track, although possible slowed down by the total rewrite of the VM