Search code examples
jrubycompiled

Reasons to not compile


Having been landed with a Ruby project, I have been sceptical about the decision to use Ruby due to performance.

I was excited to discover JRuby with its Java integration. This has made the project massively easier for me. And now I have just been totally tickled even more to discover that JRuby can be compiled down to Java bytecode .

With benchmark figures like so :

fib(30) Ruby: 1.67s

fib(30) JRuby interp (client VM): 3.93s

fib(30) JRuby interp (server VM): 2.28s to 2.08s

fib(30) JRuby compiled (client VM): 1.89s to 1.79s

fib(30) JRuby compiled (server VM): 1.66s to 0.86s

I am now getting very excited about our choice of JRuby here. Is there any disadvantages or reasons why you would not compile for the production release?


Solution

  • The distribution and installations would make that decision easier for me: as a sysadmin, I'd much rather distribute just a .JAR file that can run on many JRE's than have to distribute a working JRuby instance (which is different for different OSes, for example) and my source code. Plus, you have already demonstrated that AOT-compiled code is faster than the interpreted/JIT, so all the more reason to distribute the compiled version.