Issue #15878 has been updated by shyouhei (Shyouhei Urabe).


IMHO it is challenging to make a GC-less exit fundamentally safer than exit!
GC does some important tidy-up tasks for you, like ensuring contents in IO buffers flushed.

----------------------------------------
Feature #15878: Make exit faster by not running GC
https://bugs.ruby-lang.org/issues/15878#change-78235

* 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: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>