From: Charles Oliver Nutter Date: 2009-09-03T14:20:25+09:00 Subject: Re: Confirm my Performance Test Against Java? Worth noting again that for any long-running code or benchmarks, you'll want to pass --server to use the optimizing JVM in JRuby. Much faster. On Wed, Aug 19, 2009 at 9:36 PM, wrote: > On Wed, Aug 19, 2009 at 5:05 PM, Charles Oliver > Nutter wrote: >> On Wed, Aug 19, 2009 at 8:31 AM, Ben >> Christensen wrote: >>> I've started down a path of doing various performance tests to see what >>> kind of impact will occur by using Ruby and in my first test the numbers >>> are very poor - so poor that I have to question if I'm doing something >>> wrong. >> >> 1.8.6 is pretty slow, compared to other impls. Ruby 1.9 and JRuby will >> perform better, as shown by a few folks. JRuby on a Java 6 JVM with >> --fast and --server should perform very well. > > And, of course JRuby adds other possibilities: > > $ java FileReadParse > Starting to read file... > The number of tokens is: 234937 > It took 2098 ms > > $ java FileReadParse > Starting to read file... > The number of tokens is: 234937 > It took 788 ms > > $ ruby -v file_read_parse.rb > ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0] > Starting to read file ... > The number of tokens is: 234937 > It took 2666.646 ms > > $ jruby -v file_read_parse.rb > jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) > Client VM 1.5.0_16) [ppc-java] > Starting to read file ... > The number of tokens is: 234937 > It took 3120.0 ms > > $ jruby --fast --server -v file_read_parse.rb > jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) > Client VM 1.5.0_16) [ppc-java] > Starting to read file ... > The number of tokens is: 234937 > It took 2809.0 ms > > $ jruby -v file_read_parse-2.rb > jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) > Client VM 1.5.0_16) [ppc-java] > Starting to read file... > The number of tokens is: 234937 > It took 593 ms > > $ java FileReadParse > Starting to read file... > The number of tokens is: 234937 > It took 588 ms > > $ jruby -v file_read_parse-2.rb > jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) > Client VM 1.5.0_16) [ppc-java] > Starting to read file... > The number of tokens is: 234937 > It took 595 ms > > $ cat file_read_parse-2.rb > require 'java' > java_import 'FileReadParse' > > FileReadParse.new.do_stuff > > :-) > >