Project

General

Profile

Bug #19461

Updated by ioquatix (Samuel Williams) almost 2 years ago

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

 ```ruby 
 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. 

Back