Project

General

Profile

Actions

Bug #19461

closed

Time.local performance tanks in forked process (on macOS only?)

Added by ioquatix (Samuel Williams) over 1 year ago. Updated 10 months ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:112552]

Description

The following program demonstrates a performance regression in forked child processes when invoking Time.local:

require 'benchmark'
require 'time'

def sir_local_alot
  result = Benchmark.measure do
    10_000.times do
      tm = ::Time.local(2023)
    end
  end
  $stderr.puts result
end

sir_local_alot

pid = fork do
  sir_local_alot
end

Process.wait(pid)

On Linux the performance is similar, but on macOS, the performance is over 100x worse on my M1 laptop.


Files

localtime_test.c (1.28 KB) localtime_test.c nobu (Nobuyoshi Nakada), 02/24/2023 02:33 PM
localtime_test.c (1.21 KB) localtime_test.c nobu (Nobuyoshi Nakada), 02/24/2023 02:51 PM
clipboard-202302251716-rh6ma.png (234 KB) clipboard-202302251716-rh6ma.png ioquatix (Samuel Williams), 02/25/2023 04:16 AM
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0