# ADR-001: Empirical Architecture Selection

> Summary of the empirical Node v26 benchmark study that selected zwire's 3-layer monomorphic scoped push-pull architecture with zero-cost extension slots.

> This page summarizes the empirical architecture decision record. The full original Korean record is published at [ADR-001: 실측 기반 아키텍처 선정서](/ko/architecture/adr-001/), and current V8/JSC/Rust measurements live in [Benchmarks](/architecture/benchmarks/).

## 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.** Degraded `B1` by 5.4×, `B2b` by 46–79×, and `B6` by 7.4×—restricted strictly to opt-in migration adapters (`@zwire/core/store`).

## Four empirical findings

1. **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 in `flush()`, and global `batchDepth` leaking across concurrent SSR requests. `zwire` enforces all correctness and GC gates in CI (`15/15` identical on V8 and JSC).
2. **Monomorphic `BaseNode` + forward-only unwatched links win on V8 and JSC**: Fixed-order `BaseNode` initialization avoids V8 hidden-class polymorphism, while forward-only dependency links on unwatched `computed` nodes guarantee immediate `WeakRef` reclamation without `O(V+E)` disposal cliffs.
3. **Zero-cost extension slots eliminate unused bundle tax**: Keeping `@zwire/core` free of companion imports while composing via five lazy slots (`_ext`, `_draft`, `_flushHooks`, `_keyed`/`_hydrated`, `_inst`) delivers 0 B overhead in core for unused subpaths.
4. **2-level Chunked Sorted Block Index outperforms naive sorting by orders of magnitude**: `BLOCK_TARGET = 128` with `O(1)` Top-K boundary pruning achieves `0.51 ms` / `406 KB` build and `0.038 µs/update` on 50,000 rows in V8.

## 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.
