[MacRuby-devel] Running the experimental branch

Charles Oliver Nutter charles.nutter at sun.com
Sat Apr 4 19:57:32 PDT 2009


Laurent Sansonetti wrote:
> For instance, the optimizations that are (and will be) implemented in 
> the experimental branch are not random but were selected after having 
> profiled a big MacRuby/Cocoa application and found many areas where we 
> performed badly. I assume that other implementations are using similar 
> techniques.

The interesting thing about many of these microbenchmarks is that a 
substantial part of MacRuby's performance seems to come from one key 
optimization: recursive calls.

MacRuby (experimental) fib(30) with fcalls (fib(...):
   0.060000   0.000000   0.060000 (  0.053868)
   0.050000   0.000000   0.050000 (  0.053773)
   0.050000   0.000000   0.050000 (  0.055541)
   0.050000   0.000000   0.050000 (  0.049992)
   0.060000   0.000000   0.060000 (  0.054645)

MacRuby (experimental) fib(30) with calls (self.fib(...)):
   0.180000   0.000000   0.180000 (  0.182371)
   0.180000   0.000000   0.180000 (  0.178691)
   0.170000   0.000000   0.170000 (  0.177174)
   0.170000   0.000000   0.170000 (  0.179554)
   0.180000   0.000000   0.180000 (  0.181848)

The latter numbers are roughly the same as JRuby performance without 
recursion optimization (with or without fcall).

The recursion opt is actually pretty clever...I experimented with it a 
few weeks back (achieving similar results, http://gist.github.com/67329) 
and backed off temporarily to work on other things. I also wasn't sure 
how common it would be in real code, nor was I sure it could be done 
safely while maintaining all Ruby semantics. Maybe we'll be able to 
figure that out together. :)

- Charlie


More information about the MacRuby-devel mailing list