[MacRuby-devel] Speed

Vincent Isambart vincent.isambart at gmail.com
Sun Nov 22 02:31:21 PST 2009

> While learning I run this simple exercise (the sum of even fibonacci less than 4 million) on both MacRuby 0.5.2 and ruby 1.9.1.
> the recursive version runs about 5 times faster on MacRuby and that was expected but the iterative runs about 1000!!! times slower, and that is *frankly* unacceptable.
> What's going on?

The main reason is the compilation time for both the fib_iter function and the block you pass to it. In the default JIT mode, MacRuby compiles them the first time they are called.
If you compile your code with macrubyc, there is much less difference between 1.9 and MacRuby in your iterative version.

More information about the MacRuby-devel mailing list