ReviewOS

zig-utils/zig-js

Bench: publish cold context lifecycle phase and retention evidence

#661
Closed chris opened this 9 days ago ·
9 days ago

Parent: #479 Related: #460, #461, #480, #614

Problem

The repository has an informal human-readable gc-profile lifecycle table, while #479 requires reproducible cold-context evidence that separates creation, first source/module work, destruction, retained process memory, and exact finalization. The current table aggregates repeated in-process timings, has no versioned schema or source/options identity, and cannot prove a bounded create/destroy plateau or support exact-parent causal claims.

Scope

  • Add a versioned, machine-readable cold lifecycle schema and structural validator.
  • Measure explicit no-evaluation, first-source-evaluation, first-module-evaluation, and full-feature context scenarios without hiding context creation, builtin installation, parsing/compilation, finalization, or destruction outside their declared boundaries.
  • Retain per-sample create, configure/evaluate, destroy, total wall/CPU, peak/current/retained RSS, allocator/GC ownership, and Context.GcFinalizerStats counts.
  • Add repeated create/destroy soak checkpoints that distinguish healthy bounded allocator reuse from monotonically retained context-owned state.
  • Record exact zig-js/Zig/OS/hardware revisions, context options, source/module checksums, sample order, power/thermal availability, and every rejected/contaminated sample.
  • Integrate schema and fixture self-tests into the existing benchmark validation gate and document the publication boundary.

No-workaround rules

No pre-created contexts, hidden warmup in cold scenarios, shared mutable realm state, delayed finalizers, forced GC presented as ordinary teardown, unbounded pools/caches, omitted samples, or peak RSS substituted for post-teardown current RSS.

Acceptance

  • Machine-readable fixtures cover no-evaluation, source, module, and full-feature cold lifecycles with exact boundary/identity metadata.
  • Every accepted sample includes separated create/work/destroy timings, current/peak/retained RSS, and exact finalizer counts or an explicit unavailable reason.
  • Soak validation rejects monotonic context-owned retention and verifies callbacks/finalizers exactly once.
  • Exact-parent collection fails closed on dirty revisions, competing work, checksum/options drift, missing counters, thermal contamination, and unbalanced sample order.
  • Structural self-tests, complete benchmark validation, docs generation, offline links, and focused lifecycle tests pass; tooling/docs-only work flips 0 Test262 cases.
9 days ago

Implemented and pushed b815b3e7.

The frozen V1 profile and V19 integration add four non-scored context_lifecycle scenarios: no evaluation, first source, first dependency-free module, and full WebAssembly feature configuration plus first class/typed-array/JSON/RegExp work. Every sample preserves create/work/destroy phase time, fresh-process wall/CPU and Darwin counters, same-domain baseline/live/peak/post-destroy RSS, four soak checkpoints, context-options identity, checksum, and all 15 GcFinalizerStats counters. Finalizer accounting starts immediately after Context creation so mid-work collection cannot disappear from the record.

The collector requires at least eight cold iterations, exact per-iteration checksums, one lane, exact first-parent/clean revisions, alternating order, adequate CPU occupancy, no competing evidence process, measured counters, and nominal thermal state. It rejects incomplete cell-kind reconciliation and material monotonic/final retained growth beyond the frozen 8 MiB/5% bound. No contexts, warmups, collections, finalizers, or pools are hidden outside the declared boundary.

Validation: all four real macOS scenarios returned their frozen checksums; a 16-context no-evaluation diagnostic plateau had identical 75% and 100% post-destroy checkpoints; runner build passed; representative matrix 25/25; complete benchmark-comparison-test 31/31; release compatibility 12/12; dependency audit 16 edges/61 tools; docs 50 pages and 268 offline links. Benchmark/tooling/docs only, so flips 0 Test262 cases. The local timing values are diagnostic and are not published as a speed claim. Fresh pushed CI is pending.

9 days ago

Completed in b815b3e7.

The V19 non-scored lifecycle profile now covers all four required cold scenarios with separated create/work/destroy timing, same-domain RSS checkpoints, exact checksums/options, full finalizer reconciliation, and fail-closed exact-parent validation. The local 31-part benchmark gate, release compatibility, dependency inventory, 50-page docs build, and 268-link offline check passed; benchmark/tool/docs-only scope flips 0 Test262 cases.

Fresh pushed gates:

The profile is already in use for #662, which was selected from a fresh current-main cold sample rather than inferred from the new schema.

Sign in to comment on this issue.