ruby/gc
Peter Zhu bbbe07a5db Speed up finalizers for objects without object ID
If the object being finalized does not have an object ID, then we don't
need to insert into the object ID table, we can simply just allocate a
new object ID by bumping the next_object_id counter. This speeds up
finalization for objects that don't have an object ID. For example, the
following script now runs faster:

    1_000_000.times do
      o = Object.new
      ObjectSpace.define_finalizer(o) {}
    end

Before:

    Time (mean ± σ):      1.462 s ±  0.019 s    [User: 1.360 s, System: 0.094 s]
    Range (min … max):    1.441 s …  1.503 s    10 runs

After:

    Time (mean ± σ):      1.199 s ±  0.015 s    [User: 1.103 s, System: 0.086 s]
    Range (min … max):    1.181 s …  1.229 s    10 runs
2024-08-16 09:26:51 -04:00
..
default.c Speed up finalizers for objects without object ID 2024-08-16 09:26:51 -04:00
gc.h Fix GC_ASSERT for gc.c and gc/default.c 2024-08-15 10:38:24 -04:00
gc_impl.h Remove rb_gc_impl_objspace_mark 2024-08-09 10:27:40 -04:00