[#101981] [Ruby master Bug#17519] set_visibility fails when a prepended module and a refinement both exist — dbfeldman@...

Issue #17519 has been reported by fledman (David Feldman).

12 messages 2021/01/08

[#102003] [Ruby master Bug#17527] rb_io_wait_readable/writable with scheduler don't check errno — julien@...

Issue #17527 has been reported by ysbaddaden (Julien Portalier).

13 messages 2021/01/11

[#102065] [Ruby master Bug#17536] Segfault in `CFUNC :define_method` — v.ondruch@...

Issue #17536 has been reported by vo.x (Vit Ondruch).

13 messages 2021/01/13

[#102083] [Ruby master Bug#17540] A segfault due to Clang/LLVM optimization on 32-bit ARM Linux — xtkoba+ruby@...

Issue #17540 has been reported by xtkoba (Tee KOBAYASHI).

12 messages 2021/01/14

[#102102] [Ruby master Bug#17543] Ractor isolation broken by `self` in shareable proc — marcandre-ruby-core@...

Issue #17543 has been reported by marcandre (Marc-Andre Lafortune).

14 messages 2021/01/15

[#102118] [Ruby master Feature#17548] Need simple way to include symlink directories in Dir.glob — keithrbennett@...

Issue #17548 has been reported by keithrbennett (Keith Bennett).

8 messages 2021/01/17

[#102158] [Ruby master Bug#17560] Does `Module#ruby2_keywords` return `nil` or `self`? — nobu@...

Issue #17560 has been reported by nobu (Nobuyoshi Nakada).

9 messages 2021/01/19

[#102163] [Ruby master Bug#17561] The timeout option for Addrinfo.getaddrinfo is not reliable on Ruby 2.7.2 — sean@...

Issue #17561 has been reported by smcgivern (Sean McGivern).

8 messages 2021/01/19

[#102249] [Ruby master Bug#17583] Segfault on large stack(RUBY_THREAD_VM_STACK_SIZE) — yoshiokatsuneo@...

Issue #17583 has been reported by yoshiokatsuneo (Tsuneo Yoshioka).

12 messages 2021/01/26

[#102256] [Ruby master Bug#17585] DWAR5 support? — v.ondruch@...

Issue #17585 has been reported by vo.x (Vit Ondruch).

19 messages 2021/01/26

[#102301] [Ruby master Bug#17591] Test frameworks and REPLs do not show deprecation warnings by default — eregontp@...

Issue #17591 has been reported by Eregon (Benoit Daloze).

14 messages 2021/01/29

[#102305] [Ruby master Feature#17592] Ractor should allowing reading shareable class instance variables — marcandre-ruby-core@...

Issue #17592 has been reported by marcandre (Marc-Andre Lafortune).

25 messages 2021/01/29

[ruby-core:101930] [Ruby master Bug#17497] Ractor performance issue

From: ko1@...
Date: 2021-01-05 07:47:37 UTC
List: ruby-core #101930
Issue #17497 has been updated by ko1 (Koichi Sasada).


flash report;


```ruby
Warning[:experimental] = false if defined? Warning[]

def task_inject
  (1..10_000_000).inject(:+)
end

alias task task_inject
# p method(:task)

MODE = (ARGV.shift || :r_parallel).to_sym
TN = 4

case MODE
when :serial
  TN.times{ task }
when :r_serial
  exit(1) unless defined? Ractor

  TN.times{
    Ractor.new{
      task
    }.take
  }
when :r_parallel
  exit(1) unless defined? Ractor

  TN.times.map{
    Ractor.new{
      task
    }
  }.each{|r| r.take}
else
  raise
end

print "%4d" % GC.count
```

and 

```
                               user     system      total        real
serial/26_mini              0  0.000000   0.000248   1.318308 (  1.318555)
serial/27_mini              0  0.000000   0.000627   1.209881 (  1.209730)
serial/master_mini          0  0.000000   0.000430   1.997904 (  1.997656)
serial/miniruby             0  0.000000   0.000254   1.723801 (  1.723786)
serial/26_ruby              0  0.000000   0.000481   1.256867 (  1.256746)
serial/27_ruby              0  0.000000   0.008709   1.098332 (  1.098257)
serial/master_ruby          0  0.000000   0.000312   1.915706 (  1.916034)
serial/ruby                 0  0.000000   0.000288   1.921821 (  1.921793)
r_serial/26_mini         N/A
r_serial/27_mini         N/A
r_serial/master_mini        1  0.000000   0.000388   2.460095 (  2.460922)
r_serial/miniruby           1  0.000000   0.000359   2.784072 (  2.784779)
r_serial/26_ruby         N/A
r_serial/27_ruby         N/A
r_serial/master_ruby        1  0.000000   0.000216   2.690338 (  2.690321)
r_serial/ruby               1  0.000000   0.000237   2.982560 (  2.983885)
r_parallel/26_mini       N/A
r_parallel/27_mini       N/A
r_parallel/master_mini      1  0.000000   0.000210  23.172113 (  6.316598)
r_parallel/miniruby         1  0.000000   0.000248  25.933848 (  7.054210)
r_parallel/26_ruby       N/A
r_parallel/27_ruby       N/A
r_parallel/master_ruby      1  0.000000   0.000214  25.243151 (  6.805798)
r_parallel/ruby             1  0.000000   0.000181  28.647737 (  7.991565)
```

* on serial execution, master is x2 slower than 2.6/2.7
* on serial execution with quiet ractor (multi-ractor-mode), master is -x2.5 times slower than 2.6/2.7
* on parallel execution with ractos, master is x7 slower than 2.6/2.7


----------------------------------------
Bug #17497: Ractor performance issue
https://bugs.ruby-lang.org/issues/17497#change-89778

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: ko1 (Koichi Sasada)
* ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin18]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
There's a strange performance issue with Ractor (at least on MacOS, didn't run on other OS).

I ran a benchmark doing 3 different types of work:
* "fib": method calls (naive fibonacci calculation)
* "cpu": `(0...1000).inject(:+)`
* "sleep": call `sleep`

I get the kind of results I was excepting for the `fib` and for sleeping, but the results for the "cpu" workload show a problem.

It is so slow that my pure Ruby backport (using Threads) is 65x faster  on my Mac Pro (despite having 6 cores). Expected results would be 6x slower, so in that case Ractor is 400x slower than it should 仭

On my MacBook (2 cores) the results are not as bad, the `cpu` workload is 3x faster with my pure-Ruby backport (only) instead of ~2x slower, so the factor is 6x too slow.


```
$ gem install backports
Successfully installed backports-3.20.0
1 gem installed
$ ruby ractor_test.rb
<internal:ractor>:267: warning: Ractor is experimental, and the behavior may change in future versions of Ruby! Also there are many implementation issues.
fib: 110 ms  |  cpu: 22900 ms  |  sleep: 206 ms
$ B=t ruby ractor_test.rb
Using pure Ruby implementation
fib: 652 ms  |  cpu: 337 ms  |  sleep: 209 ms
```

Notice the `sleep` run takes similar time, which is good, and `fib` is ~6x faster on my 6-core CPU (and ~2x faster on my 2-core MacBook), again that's good as the pure ruby version uses Threads and thus runs with a single GVL.

The `cpu` version is the problem.

Script is here: https://gist.github.com/marcandre/bfed626e538a3d0fc7cad38dc026cf0e



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread