22 Aug '13, 2pm
JRuby vs Java performance - Ruby Forum
Na Na - [Forward Reference Note: JRuby/Java Bridge Benchmark code and results at https://gist.github.com/4580344 .] I should have mentioned, there may be ways you can code your JRuby to be faster too, so you can minimize the need to use Java. Having more JRuby and less Java would, in my opinion, be a good thing, for all the reasons that we choose to code in JRuby. As one example, when JRuby calls a Java function and passes Ruby objects to it, JRuby may need to create Java objects for those parameters (e.g. strings and numbers). If the return value is a Java object, JRuby may need to create a Ruby object with its value. Consider this JRuby irb session: jruby-1.7.2 :011 > 2.class => Fixnum jruby-1.7.2 :001 > java.lang.Math.max(2, 3) (irb):2 warning: ambiguous Java methods found, using max(long,long) => 3 jruby-1.7.2 :002 > x = java.lang.Math.max(2, 3) => 3 jruby-1.7.2 :003 >...