From: shyouhei@... Date: 2019-05-27T02:19:58+00:00 Subject: [ruby-core:92856] [Ruby trunk Feature#15878] Make exit faster by not running GC Issue #15878 has been updated by shyouhei (Shyouhei Urabe). chrisseaton (Chris Seaton) wrote: > Is Ruby's GC conservative? So even if a GC is performed at exit are IO buffers guaranteed to be flushed? Yes and yes. There is a special handling code for process termination, somewhere around https://github.com/ruby/ruby/blob/trunk/eval.c#L163-L172 A rough sketch of the process is that we first run GC normally, then if something remains, that is force-recycled. ---------------------------------------- Feature #15878: Make exit faster by not running GC https://bugs.ruby-lang.org/issues/15878#change-78237 * Author: grosser (Michael Grosser) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- I noticed that exit takes 0.2 ... I'm trying to write a fast cli, so any improvement here would be great or an option to opt-out of certain cleanup tasks exit! takes a constant low time ``` ruby -rbenchmark -e 'puts Benchmark.realtime { Process.wait(fork { exit }) }' # 0.03 great! ruby -rbenchmark -rrubocop -e 'puts Benchmark.realtime { Process.wait(fork { exit }) }' # 0.18 :( ruby -rbenchmark -rrubocop -e 'GC.disable; puts Benchmark.realtime { Process.wait(fork { exit }) }' # 0.04 :D ruby -rbenchmark -rrubocop -e 'puts Benchmark.realtime { Process.wait(fork { exit! }) }' # 0.002 ... fast but unsafe ``` -- https://bugs.ruby-lang.org/ Unsubscribe: