From: brabuhr@... Date: 2009-08-20T11:36:35+09:00 Subject: Re: Confirm my Performance Test Against Java? 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 :-)