Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

A look at how ObjectSpace finalizers affect GC time

View results.txt
1 2 3 4
$ ruby test.rb false
0.210000 0.000000 0.210000 ( 0.212155)
$ ruby test.rb true
10.000000 0.280000 10.280000 ( 10.773232)
View results.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
require 'benchmark'
 
n = 10_000_000
finalizer = proc { } if ARGV[0] == 'true'
 
GC.disable
n.times {
o = Object.new
ObjectSpace.define_finalizer(o, finalizer) if finalizer
}
 
puts Benchmark.measure {
GC.enable
GC.start
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.