ReviewOS

zig-utils/zig-js

Perf: scale object churn with a larger ephemeral nursery

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

Parent: #62 Related: #44, #97 Dependency: zig-utils/zig-gc#21

Problem

The July 14 clean publication leaves object_churn as the only direct JSC loss and the largest independent-context deficit. A fresh current-head screen with exact checksum 1030552128 measured:

  • direct: zig-js 116.08 ms vs JSC 113.92 ms;
  • eight warmed independent contexts: zig-js 293.37 ms vs JSC 166.00 ms.

The workload uses identical JavaScript bytes, invocation, work, warm-up, process-order balancing, and checksum validation in both engines. Sampling attributes a large fraction of zig-js time to collectYoung, young-prefix sweep, and reusable-slot lookup. zig-gc currently fixes its default/minimum nursery at 4 MiB, so an ephemeral near-zero-survival stream cannot grow enough to amortize repeated minor-cycle setup.

Scope

  • evaluate 4/8/16/32 MiB general nursery policies through zig-gc#21;
  • retain the identical public benchmark source and timed boundaries;
  • measure direct, 1/2/4/8 warmed independent, cold, and shared rows with exact checksums;
  • preserve bounded live-set, object prototype, initialized-property, displaced-read, barrier, weak/finalization, and OOM semantics;
  • publish paired exact-parent evidence before the final full matrix.

Acceptance

  • beat JSC in the direct object-churn row;
  • materially narrow or eliminate the eight-context object-churn deficit;
  • do not regress the other nine cross-engine rows or shared object-churn throughput;
  • pass focused nursery/object semantics, comparison harness, full units once, TSan/CI, and publication guards;
  • update README, detailed report, and raw TSV from a clean measured commit;
  • reference every zig-gc and zig-js commit in this issue.
9 days ago

Closing the global larger-nursery experiment without a merge. Controlled 2/4/8 MiB candidates showed the trade-off is not a universally better default: 8 MiB could improve direct object churn but materially regressed multi-context lanes (for example 390.0 vs 346.1 ms at eight lanes in the initial screen), while 2 MiB lost direct throughput and did not consistently improve eight lanes. The retained optimization is the semantics-preserving batched sweep accounting tracked in #114; the broader JSC gap remains on #62.

Sign in to comment on this issue.