From: "jhawthorn (John Hawthorn) via ruby-core" Date: 2025-12-11T18:53:58+00:00 Subject: [ruby-core:124154] [Ruby Bug#18733] Heavy GC allocations cause performance issue with Ractor Issue #18733 has been updated by jhawthorn (John Hawthorn). Just to update that though GC is still global more progress has been made. I'm on a new PC, so rerunning the benchmark against the old SHA. ``` ��� ruby -v ruby 3.5.0dev (2025-07-02T20:01:24Z v4.0.0-preview2~2697 d5f5a56bf2) +PRISM [x86_64-linux] ��� ruby -W0 test.rb 0.000000 0.001562 28.821554 ( 3.660323) 31.873376 3.184418 35.057794 ( 12.195926) ``` ``` ��� ruby -v ruby 4.0.0dev (2025-12-11T17:53:18Z master 89e09e4daf) +PRISM [x86_64-linux] ��� ruby test.rb 0.001531 0.000000 26.558190 ( 3.387530) 31.540110 1.433400 32.973510 ( 8.224187) ``` ---------------------------------------- Bug #18733: Heavy GC allocations cause performance issue with Ractor https://bugs.ruby-lang.org/issues/18733#change-115612 * Author: jakit (Jakit Liang) * Status: Assigned * Assignee: ractor * ruby -v: ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [arm64-darwin21] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- 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: ![ruby_bug_with_m1](http://jakit.cn/screen_shot_ruby_bug.jpg) 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. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/