ReviewOS

zig-utils/zig-js

GC: make moving generations survival-aware and copy-efficient

#477
Open chris opened this 9 days ago ·
9 days ago

Parent: #459 Depends on: #476, #461

Goal

Make the moving multi-age nursery survival-aware so high-survival and shared workloads do not repeatedly copy large live graphs or suffer avoidable promotion/backing costs.

Measured problem

Moving age three copies 441.02 MiB in the forced high-survival row and runs at 0.63x its exact non-moving parent, with 65.14/99.29 ms pause p50/p95. Shared mixed movement runs at 0.80x its parent and currently reaches the automatic-compaction follow-on.

Scope

  • Attribute copy volume by cell kind, allocation site, age, size class, graph shape, remembered-set source, and promotion destination.
  • Add general survival feedback, pretenuring/promotion heuristics, adaptive nursery sizing, evacuation-set selection, large/long-lived object policy, and aging that reacts to measured survival without recognizing workloads.
  • Avoid repeatedly scanning/copying unchanged old-to-young regions through exact card/remembered-set maintenance.
  • Bound fragmentation and retained backing; coordinate promotion with compaction and finalization/weak semantics.
  • Keep policy deterministic enough for seeded tests and expose machine-readable decisions/bytes.

No-workaround rules

  • No benchmark/allocation-site name recognition, permanent movement disable for hard rows, unbounded old-generation growth, skipped barrier, or promotion policy justified only by one sample.
  • A faster high-survival row that materially worsens ephemeral/mixed memory or pauses is not complete.

Pre-registered objective gate

Before policy implementation, publish a clean exact-parent baseline that freezes the targeted copied/scanned bytes, promotion/tenuring, pause p50/p95/max, wall/CPU, retained/peak RSS, fragmentation, and ephemeral/mixed/high/shared non-regression rows. Fix thresholds before candidate results are known. Any methodology correction creates a versioned successor while retaining the original evidence.

Acceptance

  • Exact-parent evidence shows reduced copied/scanned bytes and improved high-survival/shared throughput and pause distributions.
  • The candidate satisfies the pre-registered objective artifact without workload recognition, row removal, or post-result threshold changes.
  • Ephemeral and mixed rows retain their current reclamation/backing guarantees without a noise-qualified regression.
  • Promotion/tenuring decisions conserve bytes and remain exact across relocation, weak/finalization, sibling realms, native frames, handles, Wasm, and host storage.
  • Stress/fault/leak/full-unit/no-GIL/TSan/mid-GC fuzz gates pass.
  • Policy telemetry and dated raw samples are checked in and reproducible.

Foundation

#145/#447 and current 112-sample matrix.

9 days ago

Closed #523 with weak identity indexes preserved across both nursery and full moving collection; see 6989099b.

Relocation now rewrites only weak key/value edges while the stable-id index remains authoritative. Mixed object/Symbol witnesses require actual moved cells, verify exact survivors/index counts, and pass in the no-GIL moving-nursery path under TSan. Exact-parent 4K post-move lookup falls from 244.1M to 96.4M retired instructions without an index rebuild; the ordinary control remains 1.009×. Evidence: 39eeb362.

Sign in to comment on this issue.