Project

General

Profile

Actions

Feature #15878

open

Make exit faster by not running GC

Added by grosser (Michael Grosser) almost 5 years ago. Updated over 4 years ago.

Status:
Assigned
Target version:
-
[ruby-core:92851]

Description

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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0