This is just a quick update on a short post I wrote a few days ago where I compared the speed of a few different Ruby VM's using a simple recursive Fibonacci algorithm (compliments of this article) to see just how well the new MacRuby VM stacks up to the rest of them. The results had me pleasantly surprised when MacRuby blew them all away and was even able to compete with a C version (unoptimizedof course) of the same code.
Well, today as I was, once again, perusing the links on Proggit, I came across this tempting little morsel: "LuaJIT makes Lua nearly as fast as Fortran on the Benchmarks Game". Considering that my interests in MacRuby are mainly to find a fast scripting language that is enjoyable to use and easily embeddable within a Cocoa application, I couldn't resist checking out the latest LuaJIT compiler to see how it performed on the same test relative to MacRuby. Below is the Lua code that I used to perform the tests:
The results below show Lua's best time compared to the latest MacRuby implementation.
LuaJIT 1.1.5
real 0m2.068s
user 0m2.049s
sys 0m0.009s
LuaJIT 2.0.0 beta 2
real 0m2.875s
user 0m2.845s
sys 0m0.012s
MacRuby 0.5 beta 2
real 0m1.617s
user 0m1.567s
sys 0m0.042s
MacRuby 0.5 beta 2 (Compiled)
real 0m1.240s
user 0m1.195s
sys 0m0.037s
As you can see, both the current stable version of LuaJIT and the beta of the latest development version performed admirably. Surprisingly though, MacRuby was still able to beat out Lua for the fastest implementation of the recursive Fibonacci algorithm. I don't know what those guys on the MacRuby team are up to, but it's obvious they are doing an absolutely fantastic job in making Ruby more than just a popular scripting language for the Mac. If they keep it up, at this pace it'll overtake Objective-C as the Mac's main implementation language.
Great work guys!!! Can't wait to see what's next.