Prev: String Spliting/CSV question
Next: thread.exit
From: Regis d'Aubarede on 29 Jun 2010 10:52 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 c:\usr\ruby\local>ir thread_bench.rb 1.8.6, i386-mswin32, 2009-03-31 1000 iterations by 1 threads , Duration = 2257 ms 500 iterations by 2 threads , Duration = 1305 ms 333 iterations by 3 threads , Duration = 1055 ms 250 iterations by 4 threads , Duration = 880 ms 200 iterations by 5 threads , Duration = 1026 ms 166 iterations by 6 threads , Duration = 940 ms 142 iterations by 7 threads , Duration = 989 ms 125 iterations by 8 threads , Duration = 1098 ms c:\usr\ruby\local>ruby19 thread_bench.rb 1.9.1, i386-mswin32, 2010-01-10 1000 iterations by 1 threads , Duration = 7318 ms 500 iterations by 2 threads , Duration = 7393 ms 333 iterations by 3 threads , Duration = 7335 ms 250 iterations by 4 threads , Duration = 7367 ms 200 iterations by 5 threads , Duration = 7450 ms 166 iterations by 6 threads , Duration = 7343 ms 142 iterations by 7 threads , Duration = 7349 ms 125 iterations by 8 threads , Duration = 7454 ms So it's seem that IronRuby has better use of cpus than JRuby ? Attachments: http://www.ruby-forum.com/attachment/4825/thread_bench.rb -- Posted via http://www.ruby-forum.com/.
From: Roger Pack on 29 Jun 2010 11:07 > So it's seem that IronRuby has better use of cpus than JRuby ? I've seen a bit of slowdown on jruby when using multiple threads, as well. refs: http://www.ruby-forum.com/topic/211415#new http://en.wikibooks.org/wiki/Ruby_Programming/Reference/Objects/Thread -- Posted via http://www.ruby-forum.com/.
From: Regis d'Aubarede on 29 Jun 2010 12:15 Roger Pack wrote: > I've seen a bit of slowdown on jruby when using multiple threads, as > well. Result seem different on Linux.Here same test, on same machine, on ubunbtu 10.4/virtualbox with 8 processor affinity ; regis(a)regis-desktop:~/Ruby/local$ java -version java version "1.6.0_18" OpenJDK Runtime Environment (IcedTea6 1.8) (6b18-1.8-0ubuntu1) OpenJDK Server VM (build 14.0-b16, mixed mode) regis(a)regis-desktop:~/Ruby/local$ jruby -v jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (OpenJDK Client VM 1.6.0_18) [i386-java] regis(a)regis-desktop:~/Ruby/local$ jruby thread_bench.rb 1.8.7, java, 2010-06-06 1000 iterations by 1 threads , Duration = 3930 ms 500 iterations by 2 threads , Duration = 3723 ms 333 iterations by 3 threads , Duration = 3490 ms 250 iterations by 4 threads , Duration = 3470 ms 200 iterations by 5 threads , Duration = 3353 ms 166 iterations by 6 threads , Duration = 3378 ms 142 iterations by 7 threads , Duration = 3455 ms 125 iterations by 8 threads , Duration = 4032 ms regis(a)regis-desktop:~/Ruby/local$ ir -v IronRuby 0.9.0.0 on .NET 2.0.0.0 regis(a)regis-desktop:~/Ruby/local$ ir thread_bench.rb 1.8.6, i386-mswin32, 2008-05-28 1000 iterations by 1 threads , Duration = 11091 ms 500 iterations by 2 threads , Duration = 7676 ms 333 iterations by 3 threads , Duration = 12243 ms 250 iterations by 4 threads , Duration = 7728 ms 200 iterations by 5 threads , Duration = 7767 ms 166 iterations by 6 threads , Duration = 7749 ms 142 iterations by 7 threads , Duration = 8184 ms 125 iterations by 8 threads , Duration = 8069 ms regis(a)regis-desktop:~/Ruby/local$ -- Posted via http://www.ruby-forum.com/.
From: Charles Oliver Nutter on 29 Jun 2010 16:23 On Tue, Jun 29, 2010 at 9:52 AM, Regis d'Aubarede <regis.aubarede(a)gmail.com> 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
From: Charles Oliver Nutter on 29 Jun 2010 16:32
On Tue, Jun 29, 2010 at 3:23 PM, Charles Oliver Nutter <headius(a)headius.com> wrote: > 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. Maybe also worth showing an experimental dynopt flag for JRuby that seem to improve performance dramatically, but at a small cost of some Ruby semantics (backtraces get a little funky, for example): ~/projects/jruby â jruby --server -J-Djruby.compile.dynopt=true thread_bench.rb 1.8.7, java, 2010-06-17 1000 iterations by 1 threads , Duration = 400 ms 500 iterations by 2 threads , Duration = 188 ms 333 iterations by 3 threads , Duration = 192 ms 250 iterations by 4 threads , Duration = 149 ms 200 iterations by 5 threads , Duration = 167 ms 166 iterations by 6 threads , Duration = 214 ms 142 iterations by 7 threads , Duration = 177 ms 125 iterations by 8 threads , Duration = 163 ms 1000 iterations by 1 threads , Duration = 265 ms 500 iterations by 2 threads , Duration = 160 ms 333 iterations by 3 threads , Duration = 186 ms 250 iterations by 4 threads , Duration = 148 ms 200 iterations by 5 threads , Duration = 159 ms 166 iterations by 6 threads , Duration = 151 ms 142 iterations by 7 threads , Duration = 150 ms 125 iterations by 8 threads , Duration = 171 ms ... Hopefully I can land this in JRuby 1.6, but it's on master now. - Charlie |