From: "jakit (Jakit Liang)" Date: 2022-04-15T05:04:11+00:00 Subject: [ruby-core:108246] [Ruby master Bug#18733] Ruby always using Performance Cores with Apple M1 Issue #18733 has been reported by jakit (Jakit Liang). ---------------------------------------- Bug #18733: Ruby always using Performance Cores with Apple M1 https://bugs.ruby-lang.org/issues/18733 * Author: jakit (Jakit Liang) * Status: Open * Priority: Normal * 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/ Unsubscribe: