Parent: #44 Related: #47, #48, #62, #97, #116, #118, #119, #120, #131
Goal
Make shared-realm parallel execution scale predictably without hiding contention behind comparisons to isolated JSC contexts. The fair matrix uses symmetric independent-context rows to separate engine-local throughput from shared-GC/runtime contention; shared-realm results remain a distinct zig-js capability panel with no invented public-JSC equivalent.
Completed baseline
The July 29, 2026 steady-shared matrix measures clean a7cf92c7 and is published by e4187c0f with 1,540 raw samples. Eight-lane shared scaling is:
- arithmetic 5.53x; properties 5.82x; polymorphic properties 5.38x;
- object churn 1.20x; arrays 5.54x;
- direct calls 4.55x; method calls 5.43x; closure calls 4.60x; arguments calls 5.84x;
- recursive Fibonacci 4.87x.
The shared geometric mean is 4.54x. The sole former blocker, #97, now has every lane above 1.0x with low-dispersion repeated evidence. Shared results remain correctly separate from JSC because its public API has no equivalent shared-object-graph mode.
Landed attribution and optimization
Dedicated thread/GC/mid-script-GC profiles report allocator, backing-slab, shape/binding/object/element locks, safepoint publication, collector attempts/aborts/sweeps, native wait attribution, task/waiter queues, and thread lifecycle/join behavior. General changes removed or amortized shared allocation and lock traffic with explicit ownership/tracing invariants, including lock-batched GC slabs, fixed-shape allocation, queue head cursors/capacity chunks, nursery collection, and the 128-byte ordinary-object layout.
Profiles and rejected exact-parent experiments now isolate #97 to remaining object allocation/backing/sweep serialization. In particular, merely enabling the abort-safe collector, polling nursery pressure at every checkpoint, widening the fixed-shape checkpoint batch, and a zig-gc owned-batch splice did not solve the eight-lane scaling contract. Continue through #97 with causal exact-parent evidence rather than broad speculative lock removal.
Acceptance criteria
- Add focused counters/profiles for GC phases, safepoint waits, allocator/backing contention, hot shared locks, native waits, thread startup, and join behavior.
- Profile arithmetic, properties, polymorphic properties, object churn, arrays, direct/method/closure/arguments calls, and recursion at 1/2/4/8 lanes.
- Attribute every remaining sub-1.0x scaling row to measured contention; #97 owns object churn.
- Reduce global locks and shared allocator traffic only with explicit ownership and tracing invariants.
- Keep semantic no-GIL, lifecycle, mid-GC, broad-fuzz, full-unit, and suppression-free TSan coverage green.
- Keep shared-realm scaling at or above 1.0x at every reported lane count for every workload (#97).
- Make no shared-realm-vs-JSC throughput claim without a semantically equivalent public JSC mode.