From: Charles Oliver Nutter Date: 2010-06-30T05:23:41+09:00 Subject: Re: Multi-cpu and ruby Threading On Tue, Jun 29, 2010 at 9:52 AM, Regis d'Aubarede wrote: > Hello, > > We receive a new PC based on I Core 7 on Windows 7. > So i try to compare the use processors resources of each > Ruby interpretor (JRuby,IronRuby,Ruby 1.9.1 ). > I do the same (stupid) treatment by 1 to 8 threads, and measure > the global duration. > > (test program is on attachment) > > Here is the result. > > c:\usr\ruby\local>jruby  thread_bench.rb > 1.8.7, java, 2010-05-12 > 1000 iterations by 1 threads  , Duration  = 2772 ms > 500 iterations by 2 threads   , Duration  = 2076 ms > 333 iterations by 3 threads   , Duration  = 1884 ms > 250 iterations by 4 threads   , Duration  = 1848 ms > 200 iterations by 5 threads   , Duration  = 1814 ms > 166 iterations by 6 threads   , Duration  = 1755 ms > 142 iterations by 7 threads   , Duration  = 1866 ms > 125 iterations by 8 threads   , Duration  = 1538 ms Probably not running server VM, so pass --server. Overall times should be better, but depending on the algorithm the remaining bottleneck for JRuby may or may not be CPU-bound. The initial iteration's time should probably be largely discounted, and the whole thing should probably be run a couple times to see the actual perf of a longer-running app. I don't have IronRuby here, but here's numbers for me on Java 6, server, OS X, Core 2 Duo 2.6GHz: (2nd time through in the same script, only the 1 and 2 processor runs): 1000 iterations by 1 threads , Duration = 2633 ms 500 iterations by 2 threads , Duration = 1628 ms If with --server on your system JRuby's still slower than IronRuby, there may be a bug or bottleneck we can repair. I have been meaning to make blocks faster in JRuby, but they still come with a higher cost than some other impls. - Charlie