From: Sander Land Date: 2008-01-10T19:40:00+09:00 Subject: Re: [ANN] JRuby 1.1 RC 1 Released On Jan 10, 2008 2:40 AM, Charles Oliver Nutter wrote: > > Sander Land wrote: > > On Jan 10, 2008 12:35 AM, Charles Oliver Nutter wrote: > >> What Java version is this? > >> > >> - Charlie > > > > $ java -version > > java version "1.6.0_03" > > Java(TM) SE Runtime Environment (build 1.6.0_03-b05) > > Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing) > > Can I see the benchmark? I'd like to investigate why it's not still > faster than 1.8, even after -O3. > > - Charlie > The benchmark depends on a ~1500 line library. I can send you an email when I have the next release (in a few days), but I'm not sure if digging through the library would be an effective use of your time. The benchmark show that JRuby is a little slower, independent of the specific selection, crossover or mutation algorithm used. The only thing in the inner loop that all of these algorithms have in common are the fitness evaluations. This script takes just the fitness evaluations, and it does seem the problem is in this code: require 'enumerator' class RR attr_accessor :genes def initialize @genes = Array.new(64){rand(2)} end def fitness 1 + genes.enum_slice(8).find_all{|e| e.all?{|x|x==1} }.size end end require 'benchmark' Benchmark.bmbm{|x| x.report{ 200_000.times{ RR.new.fitness } } } 1.8 -O3 user system total real 15.350000 0.160000 15.510000 ( 16.929467) 1.9 -O3, (with alias :enum_slice :each_slice) user system total real 9.530000 0.000000 9.530000 ( 9.530245) JRuby -C user system total real 35.701000 0.000000 35.701000 ( 35.701000) JRuby +C user system total real 32.980000 0.000000 32.980000 ( 32.981000) I also ran one of my other benchmarks (a function optimization test) which uses the same library. 1.8 compiled : 81.39 1.9 compiled : 43.79 JRuby -C: 95.28 JRuby +C: 63.98