ADR-001: Empirical Architecture Selection
This page summarizes the empirical architecture decision record. The full original Korean record is published at ADR-001: 실측 기반 아키텍처 선정서, and current V8/JSC/Rust measurements live in Benchmarks.
Executive verdict
Section titled “Executive verdict”Selected architecture: a 3-Layer Synthesized Architecture combining a monomorphic scoped push-pull core (@zwire/core) with five zero-cost lazy extension slots for rebaseable optimistic layers, STM drafts, incremental Top-K collections, fine-grained stores, optics, and wire protocols.
- Adopting any single prototype candidate (
Cand A–Cand E) as-is: NO-GO. Every standalone candidate exhibited either correctness defects, memory cliffs, or bundle/speed trade-offs under process-isolated measurement. - Flat TypedArray SoA (
Cand C): CORE NO-GO. Lost all 9 V8 speed benchmarks and suffered GC retention issues. - Proxy-tracked immutable world (
Cand D): CORE NO-GO. DegradedB1by 5.4×,B2bby 46–79×, andB6by 7.4×—restricted strictly to opt-in migration adapters (@zwire/core/store).
Four empirical findings
Section titled “Four empirical findings”- Baseline correctness gaps (
@tanstack/store@0.11.3): Measurement uncovered three correctness failures in the baseline—set(undefined)ignored, permanent global queue poisoning after a throwing subscriber inflush(), and globalbatchDepthleaking across concurrent SSR requests.zwireenforces all correctness and GC gates in CI (15/15identical on V8 and JSC). - Monomorphic
BaseNode+ forward-only unwatched links win on V8 and JSC: Fixed-orderBaseNodeinitialization avoids V8 hidden-class polymorphism, while forward-only dependency links on unwatchedcomputednodes guarantee immediateWeakRefreclamation withoutO(V+E)disposal cliffs. - Zero-cost extension slots eliminate unused bundle tax: Keeping
@zwire/corefree of companion imports while composing via five lazy slots (_ext,_draft,_flushHooks,_keyed/_hydrated,_inst) delivers 0 B overhead in core for unused subpaths. - 2-level Chunked Sorted Block Index outperforms naive sorting by orders of magnitude:
BLOCK_TARGET = 128withO(1)Top-K boundary pruning achieves0.51 ms/406 KBbuild and0.038 µs/updateon 50,000 rows in V8.
Post-implementation bundle budget addendum
Section titled “Post-implementation bundle budget addendum”After transitioning to production Rolldown tree-shaken builds with strict gzip budgets (node ./ts/bench/run_precision_bench.ts --check-bundles), all 30 core, subpath, and adapter bundle budgets are continuously enforced on both Node (V8) and Bun (JSC) in CI.