mirror of
https://github.com/ruby/ruby.git
synced 2026-01-26 12:14:51 +00:00
Don't force major GC when there are allocatable slots
[Bug #21838] When we have allocatable slots, we can grow the heap instead of forcing a major GC. This prevents major GC to be ran very often in certain situations. See the ticket for more details. On ruby-bench, we can see that this patch doesn't cause any significant regressions: -------------- ----------- ---------- --------- ----------- ---------- --------- -------------- ------------- bench master (ms) stddev (%) RSS (MiB) branch (ms) stddev (%) RSS (MiB) branch 1st itr master/branch activerecord 148.2 0.3 59.2 150.0 0.8 69.7 1.015 0.988 chunky-png 435.2 0.3 72.9 438.8 0.1 66.7 0.993 0.992 erubi-rails 733.8 1.2 118.7 704.8 0.2 98.3 1.077 1.041 hexapdf 1400.4 1.1 247.0 1405.0 0.9 223.7 0.986 0.997 liquid-c 32.5 3.3 32.8 32.5 2.1 30.7 1.042 0.999 liquid-compile 31.0 1.7 35.1 33.4 3.9 32.8 0.938 0.928 liquid-render 84.7 0.4 30.8 86.3 0.4 30.8 0.981 0.982 lobsters 594.7 0.6 310.5 596.6 0.4 306.0 1.057 0.997 mail 75.6 2.8 53.3 76.9 0.7 53.2 0.968 0.982 psych-load 1122.8 1.2 29.2 1145.1 0.4 31.7 0.964 0.981 railsbench 1244.7 0.3 115.5 1254.8 1.1 115.2 0.939 0.992 rubocop 103.7 0.5 94.1 104.3 0.5 92.4 0.985 0.994 ruby-lsp 88.3 0.6 78.5 88.5 1.2 77.9 0.992 0.997 sequel 26.9 0.9 33.6 28.3 1.4 32.1 0.954 0.952 shipit 1119.3 1.5 171.4 1075.7 2.1 162.5 1.873 1.040 -------------- ----------- ---------- --------- ----------- ---------- --------- -------------- -------------
This commit is contained in:
parent
1f3c52dc15
commit
8a586af33b
Notes:
git
2026-01-16 22:02:33 +00:00
@ -3810,7 +3810,7 @@ gc_sweep_finish_heap(rb_objspace_t *objspace, rb_heap_t *heap)
|
||||
heap_allocatable_slots_expand(objspace, heap, swept_slots, heap->total_slots);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else if (objspace->heap_pages.allocatable_slots < (min_free_slots - swept_slots)) {
|
||||
gc_needs_major_flags |= GPR_FLAG_MAJOR_BY_NOFREE;
|
||||
heap->force_major_gc_count++;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user