ReviewOS

zig-utils/zig-js

Recover independent-context object-churn scaling

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

Problem

The clean July 22 comparison (0c9b329a, zig-gc 88ea2543) exposes a severe object-churn scaling failure while the other nine workloads still beat JSC at eight warmed contexts. zig-js moves from 114.636 ms at one warmed lane to 3,548.104 ms at eight lanes (0.26x throughput scaling); system JSC moves from 122.697 ms to 195.609 ms (5.02x). The cold eight-lane row is similarly 3,438.036 ms versus 198.845 ms.

This is not directly comparable to the July 17 dependency/toolchain state, but it is the current user-visible bottleneck and dominates the aggregate regression.

Acceptance

  • Reproduce with the saved raw matrix and the focused object-churn profiler.
  • Attribute allocator, GC rendezvous, nursery, publication, and worker lifecycle time at 1/2/4/8 lanes.
  • Land a causal exact-parent A/B with checksum and retained-memory parity.
  • Restore monotonic independent-context scaling without regressing shared-realm safety or other matrix workloads.
  • Run focused normal/TSan gates, then regenerate the complete comparison and README scorecard.
9 days ago

Baseline evidence is now committed in 69c975e: the July 22 report and all 1,540 raw samples are linked from the README and docs. The current code baseline also passes 1,404/1,404 tests with no failures or leaks. Keep this issue open: the next batch should begin with a focused 1/2/4/8-lane profiler that separates allocator locks, GC rendezvous, nursery collection, slab publication, and worker lifecycle before changing code.

9 days ago

Completed and published.

  • Root cause: every cell allocation contended on zig-gc process-global stable-ID CAS. zig-utils/zig-gc@a09c015 reserves non-recycled 4,096-ID blocks per allocator thread; 58/58 zig-gc tests pass in Debug, ReleaseSafe, and TSan.
  • Durable profiler: 56ffd9b. Exact-parent evidence: 0f8b33c (112 timing/RSS rows plus collapsed leaf attribution).
  • Causal result at 8 lanes: 13.71x steady and 14.14x cold speedup; scaling restored to 4.12x/4.44x in the A/B; checksums match and candidate RSS stays within 3.1%/1.1%.
  • Complete clean matrix: 034fa5d, 1,540 samples. Object churn scales monotonically to 4.32x steady and 4.62x cold; direct now beats JSC. Aggregate independent scaling is 5.31x steady and 5.53x cold.

The remaining object-churn work is intentionally separated: shared-realm 0.74x is tracked by #97, and the final independent JSC gap remains part of #44. #49 stays the shared-scaling umbrella.

Sign in to comment on this issue.