Skip to content

GC: parallelize and shorten shared precise collection pauses #476

Description

@chrisbbreuer

Parent: #459
Depends on: #461

Goal

Reduce shared precise-GC pause time and collector CPU by making sweep/reclamation and safe phases parallel/incremental where provably correct.

Measured problem

The July 29 moving shared row reaches 110.56 ms maximum pause, 0.80x non-moving-parent throughput, and bounded rendezvous retries. The earlier object-churn profile attributes 87.4% of its eight-lane cooperative pause to nursery sweep, while rendezvous and trace are negligible. A whole-run backing-reclamation prototype reduced sweep only 0.7% and regressed wall time 0.9%, so that rejected design must not be repeated without new evidence.

Scope

  • Re-profile the current precise nursery after 14d94ec0 and separate park, root publication, prepare, trace, copy/rewrite, sweep, finalization, backing reclaim, and resume.
  • Partition sweep/reclamation by independently owned slab/chunk/card ranges with deterministic merge and no shared hot cursor.
  • Move safe bookkeeping outside stop-the-world windows or make it concurrent/incremental with explicit phase/state barriers.
  • Bound helper count, work stealing, scratch, retry, and tail latency; avoid parallel overhead on small heaps.
  • Coordinate all algorithm changes with the owned ../zig-gc sibling and keep stable-ID/relocation contracts exact.

No-workaround rules

  • No longer allocation tranche presented as a collector fix, skipped sweep/finalization, hidden whole-run retention, disabled movement, larger unbounded reserve, or lower collection frequency without equivalent memory evidence.
  • Do not reintroduce the rejected Perf: reclaim dead nursery backing in whole slab runs #427 whole-run scheme unchanged.

Pre-registered objective gate

Before the first production optimization lands, run the current clean exact-parent phase/matrix harness and check in or attach a frozen objective artifact naming the targeted rows, pause p50/p95/max, wall/CPU, phase times, helper/scratch/RSS, retry/timeout, and required non-regression rows. Success thresholds and allowed noise are fixed before candidate results are inspected; a methodology correction versions the baseline and preserves the original.

Acceptance

  • Current exact-parent profiles show the post-change phase responsible for the gain; checksums and byte conservation match.
  • The candidate satisfies the pre-registered objective artifact without moving thresholds, deleting rows, or changing work.
  • Shared pause p50/p95/max and wall throughput improve materially with bounded scratch/RSS and no single-mutator regression.
  • Ephemeral, mixed, high-survival, shared, compaction, weak/finalization, fault/OOM, and movement inventories pass.
  • Mid-GC fuzz, lifecycle fuzz, no-GIL corpus, full unit, and suppression-free TSan pass at production time budgets.
  • Raw dated evidence is published only after a clean full matrix.

Foundation

#426, #427, #446, #447; current generation evidence; precise nursery batching at 325a12ba.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgcGarbage collection, allocation, and memory lifecycleperformanceMeasured runtime, memory, scaling, or build performance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions