Slower with multiple threads--expected?

Hi.
I noticed that this code:

for i in 1…10000000 do; end

when run in two threads, like http://gist.github.com/435159

takes
12.764s

when run on a dual core machine, whereas if you run only one of the two
threads, it takes

11.8s

Is this expected? Reportable to jira?

-rp

takes
12.764s

when run on a dual core machine, whereas if you run only one of the two
threads, it takes

11.8s

Here’s another example:

using two threads:

$ time jruby --server process_single_ip.rb

real 1m37.403s
user 3m9.874s
sys 0m5.407s

using one thread:

$ time jruby --server process_single_ip.rb

real 2m24.468s
user 2m23.192s
sys 0m4.766s

You’ll notice that the overall time for using two threads is less (which
is good), however the “user” time is far different between the two, so
we’re not seeing linear speedup (this is with plenty of cores available,
so that’s not the problem). So…is this worth a JIRA?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs