|
| 1 | +**perf(gc): live-proportional collection budgets at both generations (#7592)** |
| 2 | + |
| 3 | +Three changes, one principle: no constant band may pace a collector whose |
| 4 | +per-cycle cost is O(live) — total work goes quadratic in the live set, and a |
| 5 | +bigger constant only moves the cliff. |
| 6 | + |
| 7 | +1. The survivor-promotion handoff fires on **current** old-gen pressure only. |
| 8 | + It used to fire on `old + promotable` — but promotable bytes sit in the |
| 9 | + survivor space, where a full mark-sweep can neither reclaim them nor the |
| 10 | + old-gen space they have not yet occupied. A handoff over a near-empty |
| 11 | + old-gen is guaranteed futile (measured: 1,015 ms over 4.2 MB, 0 freed). |
| 12 | +2. A copying minor's promoted bytes credit the old-reclaim baseline: they are |
| 13 | + live by construction, so a reclaim fired because promotion crossed a |
| 14 | + threshold finds them all live and frees nothing (measured: 2,100 ms over |
| 15 | + 274 MB just-promoted, 0.0 MB freed). Standard GOGC trade: the one visible |
| 16 | + ratchet cost is `12_large_live_set.heap_total_bytes` +36 % (reserved |
| 17 | + high-water from collecting less often) while its heap_used is flat and its |
| 18 | + peak RSS and wall both improve. |
| 19 | +3. Both pacing bands become live-proportional: the old-reclaim growth band is |
| 20 | + `max(32 MB, baseline/2)` (shared by dueness and debt so they cannot |
| 21 | + diverge), and the scavenge nursery cap is `max(influx_driven, |
| 22 | + old_gen_reclaimable/2)` — keyed on old-gen occupancy, not total arena |
| 23 | + in-use, which would be a fixed point from-space can never cross. |
| 24 | + |
| 25 | +`json_pipeline` `build_out`, 500k records: 61.6 s (main) / 12.1 s (#7594 |
| 26 | +latch) → **5.8 s**, 10.6× vs main, ns/record flat within ~30 % across a 20× |
| 27 | +size range (main grows 70×). Output hash identical on every row; RSS +1.7 % |
| 28 | +over the latch arm. |
0 commit comments