Actions
Bug #18733
openRuby GC problems cause performance issue with Ractor
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21]
Description
Code:
require 'benchmark'
def fib(n)
return n if [0,1].include?(n)
fib(n-1) + fib(n-2)
end
tp = []
puts Benchmark.measure {
8.times do
tp << fork { fib(37) }
end
tp.each { |t| Process.wait(t) }
}
puts Benchmark.measure {
8.times.map {
Ractor.new { fib(37) }
}.each{ |r| r.take }
}
Result:
A | B |
---|---|
fork | 0.000264 0.003439 87.181198 ( 11.211349) |
Ractor | 80.292916 15.062559 95.355475 ( 39.569527) |
And I found that here's the problem showing on the ActiveMonitor.app:
As you can see, the process of ruby is always using all Performance Cores on my Apple M1 Mac.
But there's no one of the Efficiency Cores was in used by ruby Ractor.
Actions
Like0
Like0Like0Like0Like0