@zakkster/lite-signal 1.6.0-alpha.2 → 1.6.0-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,7 +4,61 @@ All notable changes to `@zakkster/lite-signal` are documented here.
4
4
  Format: [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
  This project follows [Semantic Versioning](https://semver.org/).
6
6
 
7
- ## [Unreleased]
7
+ ## [1.6.0-beta] -- 2026-07-27
8
+
9
+ Promotes `1.6.0-alpha.0` to the `beta` dist-tag. The engine gains one behavioural
10
+ fix over alpha.0 -- the dangling re-tracking cursor crash below, which touches
11
+ `disposeNode` / `freeLink` -- plus 100% branch coverage and a completed torture
12
+ surface; `createScope`, the `flushPasses` stat, and the op-6 / op-7 mutation-hook
13
+ opcodes are carried forward from alpha.0 unchanged.
14
+
15
+ ### Added -- torture suite completed: `introspect-torture`, and `scope-torture` now runs
16
+
17
+ `bench/torture/run.mjs` now registers **17 scenarios (14 semantic + 3 soak)** --
18
+ the forward-compatible superset through 1.9. Two changes matter on the 1.6.0
19
+ engine specifically. First, **`scope-torture`** -- present but feature-skipped on
20
+ the 1.5.0 line -- now **executes**, since `createScope` exists: it fuzzes the
21
+ adoption contract (computeds/effects adopted, plain signals not; the
22
+ `signals + computeds + effects === activeNodes` invariant), the disposal-crash
23
+ repro and a 300-seed fuzz of it, `runWithOwner` re-attachment into a scope, and
24
+ pool balance over 200 scope rounds on a hard-ceiling registry. Second, a new
25
+ semantic scenario **`introspect-torture`** closes the one 1.6.0 gap the rest of
26
+ the suite left open: the read-only introspection surface
27
+ (`describe` / `nodeId` / `hasObservers` / `isTracking` /
28
+ `forEachObserver` / `forEachSource` / `forEachOwned` / `ownerOf` /
29
+ `observeObservers`) that lite-devtools and lite-studio build on. Because these
30
+ calls cannot corrupt a value, every value/wakeup/work oracle is blind to them --
31
+ so a wrong `hasObservers` or a `forEachSource` that skips a link is a silent
32
+ correctness bug in every tool that trusts it. It pins two load-bearing
33
+ properties: **walk agreement** (the source/observer walk must match the real edge
34
+ set and track dynamic rewiring, cross-checked against both the reference dep set
35
+ and the op-3/op-4 link lane) and **the ABA gen-stamp guard** (a descriptor
36
+ captured before a node is disposed and its slot recycled must resolve to nothing,
37
+ never the new resident -- the only scenario that catches this guard's removal).
38
+
39
+ Every scenario feature-detects and **skips cleanly** below the engine version
40
+ that introduces its feature, so on the 1.6.0 engine the runner executes **11
41
+ semantic** scenarios and reports a clean SKIP for the three later-version ones
42
+ (`flush-torture` 1.7.0, `cleanup-return-torture` 1.8.0, `dispose-torture` 1.9.0).
43
+
44
+ ### Changed -- test file numbering collision fixed
45
+
46
+ The new `createScope` unit file shipped as `test/28-scope.test.mjs`, colliding on
47
+ the `28-` prefix with `test/28-run-with-owner.test.mjs` (getOwner/runWithOwner).
48
+ It is renamed to `test/29-scope.test.mjs`. Both always ran under the
49
+ `test/*.test.mjs` glob; the rename only restores the one-file-per-number
50
+ convention.
51
+
52
+ ### Verified -- full suite green on the 1.6.0 engine (Node 22, `--expose-gc`)
53
+
54
+ - **Torture:** 17/17 -- `torture:semantic` 14/14 (11 executed, 3 clean skips),
55
+ `torture:soak` 3/3 (zero errors, every pool back to its leaf-only floor).
56
+ - **Unit:** 467 tests, 456 pass, 0 fail, 1 skip (the architectural SSR N/A in
57
+ `17-reactivity`). The 1 skip aside, the only non-passes are the 10 in
58
+ `test/25-devtools-real-boot`, the real-rig that requires the sibling
59
+ `@zakkster/lite-devtools`; with that sibling resolvable the suite is 466 pass +
60
+ 1 skip. Up from alpha.0's 447 total -- the delta is the crash-fix regression
61
+ test and the branch-coverage-closure tests below.
8
62
 
9
63
  ### Removed -- `bench-reactive-legacy` (deprecated in 1.5.0)
10
64
 
@@ -261,29 +315,77 @@ comparable, and engine-version-aware.
261
315
  6/7 fire only while a mutation-hook listener is attached; with none, the two hook
262
316
  fire sites are pure `null`-check branches (branch-predicted-free after warmup).
263
317
 
264
- ### Verified -- fresh 1.6.0-alpha bench sweep
265
-
266
- Both benches re-run on the 1.6.0-alpha engine and committed to
267
- `bench/results.txt` (isolated propagation, 9 scenarios) and
268
- `bench/resultsReactive.txt` (cross-framework reactivity, median-of-10, 34
269
- tests). The 10 raw reactive-suite runs sit under `bench/bench-runs-reactive/
270
- run_1.txt` ... `run_10.txt` so anyone can re-median independently.
271
-
272
- - **Propagation bench (results.txt):** lite +49% / +43% / +35% / +29% on the four
273
- allocation-heavy scenarios (SELECTIVE DAG / DYNAMIC DAG / MUX / SMALL
274
- SELECTIVE) -- unchanged in character from the 1.5.0-beta sweep, the gate is
275
- round-off on allocation-dominated shapes. Parity on LARGE WEB APP (-3%) and
276
- WIDE DENSE (-6%), inside host noise. **Alien-signals ahead on BROADCAST
277
- (-10%), KAIROS (-12%, was -7% on 1.5.0-beta), and DEEP CHAIN (-21%, was -14%
278
- on 1.5.0-beta)** -- the KAIROS and DEEP CHAIN widening is the observable
279
- gate cost on shapes where every branch matters. Speed wins vs alien: **4/9**
280
- (was 5/9); heap wins: **8/9** (unchanged).
281
- - **Reactive suite (resultsReactive.txt):** fastest of five frameworks on all
282
- five `dyn` rows (simple +19%, dynamic +13%, large web app +11%, wide dense
283
- +4%, deep +16%). On the `S: updateComputations` micro-rows lite trades the
284
- lead with alien: **4/7 wins this sweep** (was 7/7 on 1.5.0-beta), consistent
285
- with the gate cost on 50-70ms rows that iterate many thousands of times per
286
- measurement.
318
+ ### Verified -- fresh 1.6.0-alpha bench sweep (dual-host: Apple M4 Pro + 2016 Intel MacBook)
319
+
320
+ Both v3 instruments were re-run in full on the 1.6.0-alpha engine on **two hosts**:
321
+ the current authoritative machine **Apple M4 Pro darwin/arm64, Node 26.3.1** (with
322
+ `#STAMP`-verified outputs committed to `bench/r.txt` -- microscope aggregate, 4
323
+ engines across the six first-party shapes -- and `bench/rb.txt` -- mirror sweep,
324
+ Andrii's canonical adapter verbatim, lite vs alien across 47 rows, isolated-per-row,
325
+ 10 reps) and the older reference host **2016 Intel MacBook Pro, Node 22** (kept
326
+ sweep-over-sweep for cross-host reference; `bench/results.txt` propagation, 9
327
+ scenarios, and `bench/resultsReactive.txt` cross-framework reactivity, median-of-10,
328
+ 34 tests -- the 10 raw reactive-suite runs sit under `bench/bench-runs-reactive/
329
+ run_1.txt` ... `run_10.txt` so anyone can re-median independently). The M4 Pro host
330
+ has a lower run-to-run noise floor than the Intel host, so the sub-percent parity
331
+ band tightens; conversely the Intel host makes small branch-cost swings visible
332
+ that the M4 Pro's frontend absorbs.
333
+
334
+ - **Microscope aggregate on M4 Pro (r.txt):** on the six v3 microscope shapes, lite
335
+ wins vs alien on **MUX +35.3%** (fan-in), **SELECTIVE DAG +20.6%**, **DYNAMIC DAG
336
+ +17.7%**, and -- new this sweep -- **BROADCAST +12.0%** (flipped from -1.2%
337
+ parity on 1.5.0-beta; fan-out is now a fourth speed win). The three allocation-
338
+ heavy wins hold their 1.5.0-beta M4 Pro magnitudes within noise because the
339
+ mutation-hook gate is round-off relative to per-iteration retracking work.
340
+ **KAIROS narrowed from -15.7% to -9.9%** -- the exact opposite of what the Intel
341
+ host shows for the same engine, which is what you would expect if branch
342
+ prediction on the M4's frontend is absorbing the two hook-gate `null` checks
343
+ completely. DEEP CHAIN stays firmly in alien's column at -73.8% (the
344
+ architectural weak spot the honest framing has always named: recursive JS-stack
345
+ computed resolution against a flat chain). Speed wins vs alien: **4/6** (was
346
+ 3/6 on 1.5.0-beta); heap wins: **5/6** with the sixth being a shared-zero on
347
+ BROADCAST.
348
+ - **Propagation bench on Intel (results.txt):** lite +49% / +43% / +35% / +29% on
349
+ the four allocation-heavy scenarios (SELECTIVE DAG / DYNAMIC DAG / MUX / SMALL
350
+ SELECTIVE) -- unchanged in character from the 1.5.0-beta Intel sweep, confirming
351
+ the gate is round-off on allocation-dominated shapes. Parity on LARGE WEB APP
352
+ (-3%) and WIDE DENSE (-6%), inside host noise. **Alien-signals ahead on
353
+ BROADCAST (-10%), KAIROS (-12%, was -7% on 1.5.0-beta), and DEEP CHAIN (-21%,
354
+ was -14% on 1.5.0-beta)** -- the KAIROS and DEEP CHAIN widening IS the observable
355
+ gate cost on this slower host, one predicted `null` check per inner-loop
356
+ iteration on shapes that iterate 1000-25000 times per rep. That the same
357
+ engine reads KAIROS -12% on Intel and -9.9% on M4 Pro is not a contradiction;
358
+ it is what a cross-host branch-cost artifact looks like when only one of the two
359
+ frontends can hide it. Speed wins vs alien on Intel: **4/9** (was 5/9); heap
360
+ wins: **8/9** (unchanged).
361
+ - **Microscope heap (the actual story) on M4 Pro:** on every shape where GC
362
+ pressure exists at all, lite allocates **one to four orders of magnitude less
363
+ transient heap than alien** -- DEEP CHAIN 0.5 KB vs 1062 KB (>2000x, on the
364
+ shape lite loses on time), MUX 0 KB vs 781 KB, KAIROS 23 KB vs 802 KB (34.3x),
365
+ DYNAMIC DAG 3.4 MB vs 60.0 MB (17.9x), SELECTIVE DAG 7.6 MB vs 78.2 MB (10.3x).
366
+ Against preact-signals and solid-signals the heap gap is even wider on the
367
+ fan-in / fan-out family; solid allocates ~17 MB on MUX and ~15 MB on SELECTIVE
368
+ DAG where lite allocates 0 KB and 7.6 MB on the same shapes. The
369
+ differentiated position is ALLOCATION, not raw propagation speed --
370
+ competitive-to-winning throughput with dramatically lower GC pressure, and
371
+ that is the headline that reproduces across hosts.
372
+ - **Mirror sweep on M4 Pro (rb.txt):** Andrii's canonical 47-shape suite re-run
373
+ isolated-per-row lite vs alien on M4 Pro reproduces the same honest framing:
374
+ lite runs **parity-to-behind alien on throughput** across the suite (wins
375
+ outright on **5/47** -- `1000x5 - 25 sources (wide dense)` +12.2%,
376
+ `manySourcesIntoOneComputedEffectWithDirect` +31.8%,
377
+ `manySourcesIntoOneComputedEffect` +31.4%, `molBench` +1.0% (new this sweep),
378
+ and `createComputations4to1` +9.5%; up from 4/47 on 1.5.0-beta), weak on the
379
+ deep/layered-burst family. Every row carries a `#STAMP` and the counters
380
+ (`nodesRecomputed` / `edgesTraversed` / `sinkReads`) match Andrii's published
381
+ suite exactly (`mirror.mjs --self-verify`), so a lite-vs-alien delta here is
382
+ identical work, not DCE.
383
+ - **Reactive suite on Intel (resultsReactive.txt):** fastest of five frameworks
384
+ on all five `dyn` rows (simple +19%, dynamic +13%, large web app +11%, wide
385
+ dense +4%, deep +16%). On the `S: updateComputations` micro-rows lite trades
386
+ the lead with alien: **4/7 wins this sweep** (was 7/7 on 1.5.0-beta),
387
+ consistent with the gate cost on 50-70ms rows that iterate many thousands of
388
+ times per measurement on the Intel host.
287
389
  - **Andrii Volynets js-reactivity-benchmark position holds at 4th of 15** with
288
390
  geomean **73.1ms** (raw log `bench/AndriiVolynetsReactiveBench.log`, all 15
289
391
  x 47 rows); lite is ahead of 5th-place Preact Signals (79.9) by ~9%.
package/README.md CHANGED
@@ -748,27 +748,24 @@ These are the questions you'd ask in a code review, with the answers:
748
748
 
749
749
  ## Benchmarks
750
750
 
751
- Honest numbers, against the same workload, with anti-DCE sinks and verified effect execution. All measurements: Node 22, **2016-era Intel MacBook Pro (4 cores, ~10 yr old hardware)**, **one engine per cold process**, median across reps. Newer/faster machines shift all libs up proportionally; the relative ordering between libs is what matters. Numbers below are the **fresh 1.6.0-alpha bench sweep** (default `prealloc: "eager"`) vs alien-signals on the same `benchmark.mjs` loop -- the harness reports **median execution time + transient heap** rather than ops/s. 1.5.0 -> 1.6.0-alpha changes the hot path for the first time since 1.2.2: two new mutation-hook opcodes fire under a `null`-check gate -- op 6 (`flush-pass-start`) once per pass in `flushEffects`, op 7 (`effect-enqueue`) inside `markDownstream`'s inner loop when a dirty subscriber is enqueued -- so the sha256 of those two function bodies no longer matches 1.5. Both gates are branch-predicted-free when the hook is null; the residual cost is one predicted branch per fire site. The `flushPasses` counter on `stats()` (the new 12th key) advances only while a hook is attached. Everything else is byte-identical to 1.5.1-beta.1 (sha256-verified over `pullComputed`, `executeEffect`, `runCleanup`, `disposeNode`, `allocateLink`, `severTail`, `createNode`, `createRoot`, `createScope`). Third-party engine versions carried forward from the 1.5.0-beta sweep. Full per-engine tables: [`results.txt`](bench/results.txt) (this propagation suite) and [`resultsReactive.txt`](bench/resultsReactive.txt) (the cross-framework reactivity suite). The 10 raw reactive-suite runs are checked into [`bench/bench-runs-reactive/`](./bench/bench-runs-reactive/) so anyone can re-median them independently.
751
+ Honest numbers, against the same workload, with anti-DCE sinks and verified effect execution. All measurements: **Node 26.3.1, Apple M4 Pro (darwin/arm64)**, **one engine per cold process**, median across reps, machine-stamped `#STAMP` (engine + harness sha256, live registry config, host, node) on every output. Newer/faster machines shift all libs up proportionally; the relative ordering between libs is what matters -- and on this newer silicon the run-to-run noise floor is lower, so the sub-percent parity band tightens and the honest wins/losses stand out cleanly. Numbers below are the **fresh 1.6.0-alpha bench sweep** on the v3 **microscope** (`benchmark.mjs`, six first-party shapes, default `prealloc: "eager"`) vs alien-signals -- the harness reports **median execution time + transient heap** rather than ops/s. 1.5.0 -> 1.6.0-alpha changes the hot path for the first time since 1.2.2: two new mutation-hook opcodes fire under a `null`-check gate -- op 6 (`flush-pass-start`) once per pass in `flushEffects`, op 7 (`effect-enqueue`) inside `markDownstream`'s inner loop when a dirty subscriber is enqueued -- so the sha256 of those two function bodies no longer matches 1.5. Both gates are branch-predicted-free when the hook is null; the residual cost is one predicted branch per fire site. The `flushPasses` counter on `stats()` (the new 12th key) advances only while a hook is attached. Everything else is byte-identical to 1.5.1-beta.1 (sha256-verified over `pullComputed`, `executeEffect`, `runCleanup`, `disposeNode`, `allocateLink`, `severTail`, `createNode`, `createRoot`, `createScope`). Third-party engine versions carried forward from the 1.5.0-beta sweep. Full outputs: [`bench/r.txt`](bench/r.txt) (this microscope aggregate across four engines) and [`bench/rb.txt`](bench/rb.txt) (the mirror sweep -- Andrii's canonical adapter verbatim, 47 rows, lite vs alien on the same M4 Pro host); the older Intel MacBook / Node 22 sweep of the same 1.6.0-alpha engine is preserved for cross-host reference at [`bench/results.txt`](bench/results.txt) and shows the gate cost surfacing as -12% on KAIROS / -21% on DEEP CHAIN there -- a host-dependent artifact of the branch cost, not visible on M4 Pro where prediction absorbs it.
752
752
 
753
753
  | Scenario | What it stresses | lite-signal | alien-signals | lite vs alien | transient heap (lite / alien) |
754
754
  | ---------- | -------------------------------- | ----------- | ------------- | ------------- | ----------------------------- |
755
- | **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **4717 ms** | 9261 ms | **+49% faster** | **1.6 MB / 29 MB** (19x less) |
756
- | **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **9770 ms** | 17238 ms | **+43% faster** | **4.9 MB / 27 MB** (5.5x less) |
757
- | **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **67 ms** | 103 ms | **+35% faster** | **38 KB / 3.9 MB** (104x less) |
758
- | **SMALL SELECTIVE** | 6 layers × 64 wide, 6 cand / 3 read | **1972 ms** | 2787 ms | **+29% faster** | **0.3 KB / 22.9 MB** (>=22888x less) |
759
- | **LARGE WEB APP** | 12 layers × ~80 wide, conditional reads | 2825 ms | 2733 ms | -3% (parity) | **0.3 KB / 41 KB** (41x less) |
760
- | **WIDE DENSE** | 5 layers × ~200 wide, dense fan-in | 2888 ms | 2729 ms | -6% (parity) | **0.3 KB / 11.6 MB** (>=11605x less) |
761
- | **BROADCAST** | 1 signal -> 1000 effects (fan-out) | 1177 ms | 1066 ms | -10% | 73 KB / 21 KB |
762
- | **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 1450 ms | 1293 ms | -12% | 179 KB / 1.1 MB (6.4x less) |
763
- | **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 397 ms | **329 ms** | -21% | 18 KB / 942 KB (52x less) |
755
+ | **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **22.77 ms** | 35.22 ms | **+35.3% faster** | **0 KB / 781 KB** (100% less) |
756
+ | **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **2013 ms** | 2536 ms | **+20.6% faster** | **7.6 MB / 78.2 MB** (90.3% less, 10.3x) |
757
+ | **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **3680 ms** | 4473 ms | **+17.7% faster** | **3.4 MB / 60.0 MB** (94.4% less, 17.9x) |
758
+ | **BROADCAST** | 1 signal -> 1000 effects (fan-out) | **447.81 ms** | 508.88 ms | **+12.0% faster** | ~0 KB / ~0 KB (both fit under GC floor) |
759
+ | **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 531.09 ms | 483.45 ms | -9.9% | **23 KB / 802 KB** (97.1% less, 34.3x) |
760
+ | **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 171.93 ms | **98.93 ms** | -73.8% | **0.5 KB / 1062 KB** (100% less, >2000x) |
764
761
 
765
762
  *(lower time = faster; transient heap = average delta-heap per rep, lower = less GC pressure)*
766
763
 
767
- **Reading the table:** lite-signal's time wins cluster exactly where its zero-GC design pays off -- the **allocation-heavy dynamic shapes** (**SELECTIVE DAG +49%**, **DYNAMIC DAG +43%**, **SMALL SELECTIVE +29%**), where alien-signals churns the nursery and lite's object pool allocates near-nothing, plus **MUX +35%** (fan-in aggregation). These four allocation-dominated wins are unchanged from the 1.5.0-beta sweep -- the mutation-hook gate is round-off on shapes where the ratio of pool retracking to marker walks favors lite by orders of magnitude. On the cheap, low-allocation **stable** shapes (LARGE WEB APP, WIDE DENSE) lite runs at **parity** with alien -- within a 3-6% band inside this old host's run-to-run noise. The three shapes where alien edges lite are BROADCAST (-10%, pure fan-out with no retracking to amortize), KAIROS (-12%, was -7% on 1.5.0-beta), and the 256-deep pipeline **DEEP CHAIN (-21%**, was -14% on 1.5.0-beta): the gate cost is measurable on shapes that iterate 1000-25000 times per rep with tiny per-iteration work, where a single extra predicted branch per iter is a visible fraction of total time. That gate cost disappears when a profiler is actually attached -- the observable then is the profiler's own cost, not the gate itself.
764
+ **Reading the table:** the M4 Pro sweep clarifies exactly which of lite-signal's wins are real and which were noise on a slower host. The **allocation-heavy dynamic shapes stay lite's home turf**: **MUX +35.3%** (fan-in aggregation), **SELECTIVE DAG +20.6%**, **DYNAMIC DAG +17.7%** -- essentially unchanged from the 1.5.0-beta M4 Pro sweep, confirming the mutation-hook gate is round-off on allocation-dominated shapes where the ratio of pool retracking to marker walks favors lite by orders of magnitude. The genuine news is **BROADCAST flipping to a +12.0% win** (was -1.2% parity on 1.5.0-beta): fan-out is now a fourth speed win on this sweep, and **KAIROS narrowed from -15.7% to -9.9%** -- the exact opposite of what the 2016 Intel host shows for the same engine, which is what you would expect if branch prediction on the M4's frontend is absorbing the two hook-gate `null` checks completely. **DEEP CHAIN -73.8%** is the one shape that stays firmly in alien's column: a 256-deep computed pipeline is the architectural weak spot the honest framing has always named (recursive JS-stack computed resolution loses to alien's flatter chain on hot new cores by a wider margin than on old Intel, and the added per-level gate cost compounds when it does show), and no amount of hook-gate accounting hides that. The mirror-sweep companion ([`bench/rb.txt`](bench/rb.txt)) reproduces the picture across Andrii's 47 shapes: lite runs **parity-to-behind alien on throughput**, wins outright on **5 of the 47** (`1000x5 - 25 sources (wide dense)` +12.2%, both `manySourcesIntoOne*ComputedEffect` fan-ins ~+32%, `molBench` +1.0%, and `createComputations4to1` +9.5%) -- and this is not the story to tell.
768
765
 
769
- On allocation pressure, `lite-signal` wins **8 of 9 scenarios** and is alone in the zero-alloc band: **~0.3 KB** of transient garbage on the stable app shapes (large web app, wide dense, small selective) across the whole run. The contrast is starkest on the dynamic DAGs -- lite allocates 1.6-4.9 MB (genuine retracking re-links) where alien-signals allocates 27-29 MB on the same shapes, and that allocation gap is the mechanism behind lite's +43-49% wins there once each engine is measured in isolation. The one scenario where lite allocates more is **BROADCAST** (73 KB vs alien's 21 KB), a pure fan-out with no retracking. `prealloc: "lazy"` trades a little extra first-construction allocation on the dynamic shapes for a smaller resident heap and faster cold start; the steady state is identical. preact and solid trail both engines on the dynamic shapes by 1-2 orders of magnitude on transient heap.
766
+ **The story is the heap column.** On every microscope shape where GC pressure exists at all, `lite-signal` allocates **one to four orders of magnitude less transient heap than alien-signals**: DEEP CHAIN 0.5 KB vs 1062 KB (>2000x less -- yes, on the shape where lite is behind on time), MUX 0 KB vs 781 KB, KAIROS 23 KB vs 802 KB (34.3x), DYNAMIC DAG 3.4 MB vs 60.0 MB (17.9x), SELECTIVE DAG 7.6 MB vs 78.2 MB (10.3x). On BROADCAST both engines are effectively zero. Against preact-signals and solid-signals the heap gap is even wider on the fan-in / fan-out family -- solid allocates ~17 MB on MUX and ~15 MB on SELECTIVE DAG where lite allocates 0 KB and 7.6 MB respectively (`bench/r.txt`). **`lite-signal`'s differentiated position is ALLOCATION, not raw propagation speed**: competitive-to-winning throughput with dramatically lower GC pressure, not "fastest dynamic-graph engine". That headline is the one that reproduces across hosts, sweeps, and third-party version bumps -- because the object pool is the mechanism, not a tuning knob.
770
767
 
771
- > Note on the +70.8 KB retained that lite-signal shows on KAIROS specifically: that's the pre-allocated pool sitting in memory holding the live graph (1002 nodes + ~2000 links). The pool *is* the working memory -- see the [Case for object pooling](#case-for-object-pooling) section. On the other benches the graph is small enough that the same pool floats below baseline after GC.
768
+ > Note on the +23 KB delta-heap that lite-signal shows on KAIROS: that's the pre-allocated pool sitting in memory holding the live graph (1002 nodes + ~2000 links). The pool *is* the working memory -- see the [Case for object pooling](#case-for-object-pooling) section. On the other shapes the graph is small enough that the same pool floats below the GC baseline.
772
769
 
773
770
  The benchmark harness is in [`bench/benchmark.mjs`](./bench/benchmark.mjs); a full methodology write-up -- including the anti-DCE design, workload diagrams, variance discipline, reproducibility recipe, and a self-validation procedure for the harness itself -- lives in [`bench/README.md`](./bench/README.md). It:
774
771
 
@@ -841,15 +838,67 @@ npm run test:gc
841
838
 
842
839
  ### Tier 3 -- Performance (comparative benchmark)
843
840
 
844
- `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes (`bench/results.txt`). Cross-framework standing comes from the **mirror** (`node --expose-gc bench/mirror.mjs --self-verify` then `bench/sweep.mjs`), which runs Andrii's canonical adapter verbatim so rows diff 1:1 against his log. Every output carries a machine-generated `#STAMP` (engine + harness sha256, the live registry config, host, node), so a header can never disagree with the code that ran. The pre-v3 five-framework reactivity suite was **removed after 1.5.1** (bench protocol v3). Full methodology: [`bench/README.md`](./bench/README.md).
841
+ `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes; the aggregate output on Apple M4 Pro is [`bench/r.txt`](bench/r.txt) (four engines: lite, alien, preact, solid), and the same engine on the older Intel MacBook / Node 22 host is preserved at [`bench/results.txt`](bench/results.txt) for cross-host reference. Cross-framework standing comes from the **mirror** (`node --expose-gc bench/mirror.mjs --self-verify` then `bench/sweep.mjs`), which runs Andrii's canonical adapter verbatim so rows diff 1:1 against his log; the aggregate output is [`bench/rb.txt`](bench/rb.txt) (lite vs alien, all 47 shapes). Every output carries a machine-generated `#STAMP` (engine + harness sha256, the live registry config, host, node), so a header can never disagree with the code that ran. The pre-v3 five-framework reactivity suite was **removed after 1.5.1** (bench protocol v3). Full methodology: [`bench/README.md`](./bench/README.md).
845
842
 
846
843
  ```bash
847
844
  npm run bench
848
845
  ```
849
846
 
850
- ### Tier 4 -- Torture soaks (crash detection under chaos)
847
+ ### Tier 4 -- Torture (correctness and resources under chaos)
851
848
 
852
- `bench/torture/` contains three soak harnesses that build large randomised graphs (1,500 / 7,500 / 3,300 nodes) and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires, effect rewires, nested-batch + untrack reads, and microtask-scheduled async flushes -- for 5-10 seconds. These are not perf benchmarks. The numbers they print (ops/sec) reflect random workload composition, not engine throughput; the existing `bench/benchmark.mjs` is the canonical perf harness. What the soaks DO assert, with a non-zero exit code on failure:
849
+ `bench/torture/` holds the complete **17-scenario superset (14 semantic + 3
850
+ soak)** behind one runner (`run.mjs`), the forward-compatible set through 1.9.
851
+ They are not perf benchmarks: the ops/sec figures reflect random workload
852
+ composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
853
+ perf harness. Every scenario feature-detects and **skips cleanly** below the
854
+ engine version that introduces its feature, so on the 1.6.0 engine the runner
855
+ executes **11 semantic** scenarios and reports a clean SKIP for the three
856
+ later-version ones (`flush-torture` 1.7.0, `cleanup-return-torture` 1.8.0,
857
+ `dispose-torture` 1.9.0).
858
+
859
+ ```bash
860
+ npm run torture # everything
861
+ npm run torture:semantic # correctness only, CI-shaped
862
+ npm run torture:soak # resource soaks only
863
+ node bench/torture/run.mjs --list
864
+ ```
865
+
866
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
867
+
868
+ Run these on every commit. The nine untagged scenarios run on any 1.4.x+ engine;
869
+ `scope-torture` (1.6.0) runs here because `createScope` exists; the three tagged
870
+ `1.7.0+`/`1.8.0+`/`1.9.0+` feature-detect and SKIP on this engine.
871
+
872
+ | scenario | pins |
873
+ | -------- | ---- |
874
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
875
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
876
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies |
877
+ | `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
878
+ | `introspect-torture` (1.6.0) | the read-only introspection surface (`describe`/`nodeId`/`hasObservers`/`isTracking`/`forEach*`/`ownerOf`/`observeObservers`): walk-agreement against the reference dep set + op-3/op-4 lane, and the ABA gen-stamp guard on re-walkable descriptors -- the substrate lite-devtools/lite-studio trust, invisible to every value oracle |
879
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts |
880
+ | `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
881
+ | `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
882
+ | `scope-torture` (1.6.0) | `createScope` adoption contract, the disposal-crash repro + a 300-seed fuzz, `runWithOwner` re-attachment into a scope, pool balance over 200 rounds |
883
+ | `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
884
+ | `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary |
885
+ | `flush-torture` (1.7.0+) | `flushStrategy` eager/sab/manual convergence + the `.subscribe()` contract -- SKIP on 1.6.0 |
886
+ | `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard -- SKIP on 1.6.0 |
887
+ | `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.6.0 |
888
+
889
+ Why `introspect-torture` earns its place: it is the only scenario that catches a
890
+ broken introspection walk or a removed ABA gen-stamp guard. Both are read-only,
891
+ so no value/wakeup/work oracle observes them -- yet a `forEachSource` that skips a
892
+ link, or a descriptor that resolves to a recycled slot's new resident, is a
893
+ silent data-corruption bug in every tool built on the surface.
894
+
895
+ #### `soak` -- wall-clock bound, asserts on **resources**
896
+
897
+ Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
898
+ and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
899
+ effect rewires, nested-batch + untrack reads, and microtask-scheduled async
900
+ flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
901
+ failure:
853
902
 
854
903
  - zero thrown exceptions during the run, and
855
904
  - after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn).
@@ -1030,30 +1079,39 @@ In stable environments (game engines, particle systems, visualizers), `lite-sign
1030
1079
  | **1000x5 (25 sources, wide/dense)** | 304ms | 303ms | 1746ms |
1031
1080
  | **64x6 (selective dynamic DAG)** | 181ms | 196ms | 559ms |
1032
1081
 
1033
- *1.5.0-beta (default eager) on the local harness (slow 2016 MacBook, one engine per cold process -- compare within-column, lite vs alien; the approximating scenarios from `bench/benchmark.mjs`):*
1034
- | Scenario | alien-signals | lite-signal (1.5.0-beta) | result |
1082
+ *1.6.0-alpha (default eager) on the v3 microscope (`bench/r.txt`, Apple M4 Pro darwin/arm64, Node 26.3.1, one engine per cold process -- compare within-column, lite vs alien):*
1083
+ | Scenario | alien-signals | lite-signal (1.6.0-alpha) | result |
1035
1084
  | :--- | :--- | :--- | :--- |
1036
- | **SELECTIVE DAG** (sqrt-layered, set churn) | 9166ms | 4757ms | **lite +48%** |
1037
- | **DYNAMIC DAG** (sqrt-layered, FAN=6) | 17375ms | 9630ms | **lite +45%** |
1038
- | **SMALL SELECTIVE** (~ 64x6) | 2745ms | 1940ms | **lite +29%** |
1039
- | **LARGE WEB APP** (~ 1000x12) | 2845ms | 2800ms | **lite +2%** (flipped from -3% on 1.4.0) |
1040
- | **WIDE DENSE** (~ 1000x5) | 2719ms | 2870ms | alien +6% |
1041
-
1042
- > **Honest note (1.5.0-beta isolated run):** measured one-engine-per-process, lite-signal's
1043
- > big wins are still on the **allocation-heavy** dynamic shapes (SELECTIVE DAG +48%, DYNAMIC
1044
- > DAG +45%, SMALL SELECTIVE +29%) -- exactly where alien churns the nursery and lite's pool
1045
- > allocates near-nothing. **LARGE WEB APP flipped into a small lite win this sweep** (+2%,
1046
- > from -3% on 1.4.0), attributable to the alien-signals 3.1.2 -> 3.2.1 bump between sweeps;
1047
- > on a ~2800ms base the sign of that parity result depends on which third-party version is
1048
- > in the other column. 1.5.0's hot paths are byte-identical to 1.4.0 (1.5.0 adds the
1049
- > `signalBox` / `computedBox` non-callable handle plus `createRoot`, none of which move
1050
- > steady-state throughput), so these match the 1.4.0 isolated numbers within noise -- not
1051
- > engine changes. lite remains the only zero-alloc library on every stable scenario
1052
- > (see [`results.txt`](bench/results.txt)).
1053
-
1054
- The cross-framework reactivity suite agrees independently, re-run on **1.6.0-alpha** (default eager, median-of-10, isolated): lite-signal is the **fastest of five frameworks on all five `dyn` rows** -- `dyn: large web app` **536ms** (+11% vs alien-signals' 600ms) and `dyn: wide dense` **903ms** (+4% vs 939ms), plus simple component (+19%), dynamic component (+13%), and deep (+16%) -- with preact 6-19x slower and vue 15-33x slower on the app-shaped graphs (see [`resultsReactive.txt`](bench/resultsReactive.txt); the 10 raw runs are checked into [`bench/bench-runs-reactive/`](./bench/bench-runs-reactive/)). On the `S: updateComputations` micro-rows lite trades the lead with alien within a few percent (4/7 wins on this sweep, was 7/7 on 1.5.0-beta -- the shift is consistent with the two new hook-gated branches in `markDownstream` / `flushEffects`, each a single predicted `null` check per fire site but visible on 50-70ms rows that iterate many thousands of times). The retracking is verified correct by `retracking.difftest.mjs` -- 20,000 direct + 10,000 batched writes, 0 disagreements against the **published 1.1.5** reference (re-pinned for v1.2).
1055
-
1056
- **The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.6.0-alpha extends the story -- the engine still ranks **4th of 15** on the official js-reactivity-benchmark (the only zero-GC library in the field, now with **6 outright wins** across wide-aggregation and mixed-app shapes). `lite-signal` keeps the zero-GC, flat-arena profile for 120fps Canvas/WebGL **and** wins decisively on the high-churn dynamic and fan-in topologies that dominate live UI -- the shapes where zero allocation pays off most. On the cheap propagation shapes (KAIROS, DEEP CHAIN, BROADCAST) the new mutation-hook gate costs a few percent (measurable because those shapes have almost no allocation for the gate to disappear into); on the wide-aggregation shapes the gate is round-off. The one shape where alien's flatter representation still leads is the 256-deep computed pipeline (DEEP CHAIN, -21% on the 1.6.0-alpha isolated run -- widened from -14% on 1.5.0-beta by the added per-level gate cost; when a profiler is attached the observable becomes the profiler's own cost and the gate itself disappears from the picture).
1085
+ | **MUX** (256 sigs -> sum -> effect) | 35.22 ms | 22.77 ms | **lite +35.3%** |
1086
+ | **SELECTIVE DAG** (sqrt-layered, set churn) | 2536 ms | 2013 ms | **lite +20.6%** |
1087
+ | **DYNAMIC DAG** (sqrt-layered, FAN=6) | 4473 ms | 3680 ms | **lite +17.7%** |
1088
+ | **BROADCAST** (1 -> 1000 effects) | 508.88 ms | 447.81 ms | **lite +12.0%** (flipped from -1.2% on 1.5.0-beta) |
1089
+ | **KAIROS** (1 -> 1000 computeds) | 483.45 ms | 531.09 ms | alien +9.9% (narrowed from -15.7% on 1.5.0-beta) |
1090
+ | **DEEP CHAIN** (256-deep -> effect) | 98.93 ms | 171.93 ms | alien +73.8% |
1091
+
1092
+ > **Honest note (1.6.0-alpha on M4 Pro):** measured one-engine-per-process, lite-signal's
1093
+ > wins cluster on the **allocation-heavy** dynamic shapes (MUX +35.3%, SELECTIVE DAG
1094
+ > +20.6%, DYNAMIC DAG +17.7%) -- essentially unchanged from the 1.5.0-beta M4 Pro
1095
+ > sweep, confirming the mutation-hook gate is round-off on allocation-dominated shapes
1096
+ > where the ratio of pool retracking to marker walks favors lite by orders of magnitude.
1097
+ > The genuine news is **BROADCAST flipping to a +12.0% win** (was parity -1.2% on
1098
+ > 1.5.0-beta): fan-out is now a fourth speed win on this sweep, and KAIROS narrowed
1099
+ > from -15.7% to -9.9% -- the exact opposite of what the 2016 Intel host shows for the
1100
+ > same engine (KAIROS -7% -> -12% there), which is what you would expect if branch
1101
+ > prediction on the M4's frontend is absorbing the two hook-gate `null` checks
1102
+ > completely. DEEP CHAIN -73.8% is the one shape that stays firmly in alien's column
1103
+ > and no amount of hook-gate accounting hides that (recursive JS-stack computed
1104
+ > resolution against a flat chain is the architectural weak spot the honest framing
1105
+ > has always named). Everything else is byte-identical to 1.5.1-beta.1 (sha256-verified
1106
+ > over `pullComputed`, `executeEffect`, `runCleanup`, `disposeNode`, `allocateLink`,
1107
+ > `severTail`, `createNode`, `createRoot`, `createScope`); only `markDownstream` and
1108
+ > `flushEffects` picked up the two new opcodes. lite remains one to four orders of
1109
+ > magnitude below alien on transient heap on every shape where GC pressure exists at
1110
+ > all (see [`bench/r.txt`](bench/r.txt)).
1111
+
1112
+ The mirror sweep ([`bench/rb.txt`](bench/rb.txt), Andrii's canonical adapter verbatim, isolated-per-row, 10 reps, lite vs alien across all 47 shapes on the same M4 Pro host) reproduces the same picture: lite runs **parity-to-behind alien on throughput**, wins outright on **5/47** (`1000x5 - 25 sources (wide dense)` +12.2%, both `manySourcesIntoOne*ComputedEffect` fan-ins ~+32%, `molBench` +1.0%, and `createComputations4to1` +9.5%; up from 4/47 on 1.5.0-beta), weak on the deep/layered-burst family. Every row carries a `#STAMP` and the counters (`nodesRecomputed` / `edgesTraversed` / `sinkReads`) match Andrii's published suite exactly, so a lite-vs-alien delta here is identical work, not DCE. The retracking is verified correct by `retracking.difftest.mjs` -- 20,000 direct + 10,000 batched writes, 0 disagreements against the **published 1.1.5** reference (re-pinned for v1.2).
1113
+
1114
+ **The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.6.0-alpha extends the story -- the engine still ranks **4th of 15** on the official js-reactivity-benchmark (the only zero-GC library in the field, now with **6 outright wins** across wide-aggregation and mixed-app shapes). `lite-signal` keeps the zero-GC, flat-arena profile for 120fps Canvas/WebGL **and** wins decisively on the high-churn dynamic and fan-in topologies that dominate live UI -- the shapes where zero allocation pays off most. On M4 Pro the win count moved to **4/6** on the microscope (MUX / SELECTIVE DAG / DYNAMIC DAG / BROADCAST) after BROADCAST flipped from parity, and KAIROS narrowed by 6 points, both against the direction the Intel host shows for the same engine -- fast-frontend branch prediction absorbs the mutation-hook gate cost that the older host makes visible (`bench/results.txt` preserves that Intel measurement at KAIROS -12% / DEEP CHAIN -21%; both are honest, and the divergence between them is a cross-host artifact of the branch cost, not a code path difference). The one shape where alien's flatter representation still leads decisively is the 256-deep computed pipeline (DEEP CHAIN -73.8% on the M4 Pro isolated run; lite's allocation on DEEP CHAIN is 0.5 KB vs alien's 1062 KB, >2000x less transient heap on the same shape).
1057
1115
 
1058
1116
  ### Roadmap
1059
1117
  - **1.1.5** -- additions in service of `lite-devtools` (node identity/traversability on the introspection walkers, for full auto-discovered graph rendering). *Shipped.*
@@ -1312,7 +1370,7 @@ Yes, if your computeFn reads its deps in the same order each invocation. The `cu
1312
1370
  ```bash
1313
1371
  npm test # behavior suite, ~1.3s
1314
1372
  npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
1315
- npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
1373
+ npm run bench # microscope + mirror comparative benches (r.txt / rb.txt), ~5min
1316
1374
  node --expose-gc bench/mirror.mjs --self-verify # cross-framework mirror sweep (bench protocol v3)
1317
1375
  npm run harness:field # verify + cold-child A/B bench (fieldkit)
1318
1376
  npm run harness:all # field + dispose + churn probes, in sequence
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.6.0
2
+ * @zakkster/lite-signal v1.6.0-beta
3
3
  * --------------------
4
4
  * Hybrid Doubly-Linked-List Reactive Graph Engine -- decoupled (Signal1_3) base
5
5
  * with the two 1.1.3 performance fixes ported in:
package/llms.txt CHANGED
@@ -54,8 +54,34 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
54
54
 
55
55
  ## Version notes
56
56
 
57
- - **1.6.0-alpha.0** (current): the **observability-and-lifecycle minor**, shipping
58
- on the `alpha` dist-tag while it settles. **Three** additions:
57
+ - **1.6.0-beta** (current): promotes `1.6.0-alpha.0` to the `beta` dist-tag. One
58
+ behavioural fix over alpha.0 -- the dangling re-tracking cursor crash
59
+ (disposing a signal/computed from inside an observer that linked it last run but
60
+ has not re-read it this run; a one-line cursor repair in `disposeNode`, O(1),
61
+ disposal path only) -- plus branch coverage on `Signal.js` closed to **100%**
62
+ and a **completed torture surface**. The alpha.0 API (`createScope`,
63
+ `flushPasses`, the op-6 / op-7 mutation-hook opcodes) is carried forward
64
+ unchanged. The torture runner now registers the full **17-scenario superset
65
+ (14 semantic + 3 soak)**: `scope-torture` -- feature-skipped on 1.5.0 -- now
66
+ **executes** on this engine (`createScope` exists), and a new semantic scenario
67
+ **`introspect-torture`** closes the read-only introspection surface (`describe`,
68
+ `nodeId`, `hasObservers`, `isTracking`, `forEachObserver` / `forEachSource` /
69
+ `forEachOwned`, `ownerOf`, `observeObservers`) that no value/wakeup/work oracle
70
+ can see -- pinning walk-agreement (against the reference dep set + the op-3/op-4
71
+ link lane) and the ABA gen-stamp guard (a descriptor captured before
72
+ dispose+recycle must resolve to nothing, never the new resident). Every
73
+ scenario feature-detects, so on 1.6.0 the runner executes **11 semantic** and
74
+ cleanly SKIPS three later-version ones (`flush` 1.7.0, `cleanup-return` 1.8.0,
75
+ `dispose` 1.9.0). The `28-scope` unit file is renamed to `29-scope` (it
76
+ collided on the `28-` prefix with `28-run-with-owner`). Verified green on the
77
+ 1.6.0 engine: torture 17/17 (semantic 14/14 = 11 run + 3 skip; soak 3/3, pools
78
+ back to their leaf-only floor); unit **467 tests, 456 pass, 0 fail, 1 skip**
79
+ (the SSR N/A in `17-reactivity`) -- 466 pass with the sibling
80
+ `@zakkster/lite-devtools` present, which the 10-test `test/25` real-boot rig
81
+ needs. Drop-in over 1.6.0-alpha.0.
82
+
83
+ - **1.6.0-alpha.0**: the **observability-and-lifecycle minor**, shipped
84
+ on the `alpha` dist-tag while it settled. **Three** additions:
59
85
 
60
86
  **1) `stats()` gains a twelfth key, `flushPasses`** -- advances once per
61
87
  effect-flush drain pass. **2) Two new `onGraphMutation` opcodes for flush
@@ -67,16 +93,20 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
67
93
  branch-predicted `null` check per fire site (per pass in `flushEffects`, per
68
94
  enqueued dirty subscriber in `markDownstream`'s inner loop). **The hot path
69
95
  is no longer byte-identical to 1.5 for the first time since 1.2.2**; the
70
- observable cost is a few percent on the cheapest propagation shapes (KAIROS
71
- -7% -> -12% vs alien on the 1.6.0-alpha sweep, DEEP CHAIN -14% -> -21%) and
72
- round-off on allocation-dominated shapes (SELECTIVE DAG +49%, DYNAMIC DAG
73
- +43%, MUX +35%, SMALL SELECTIVE +29% -- unchanged from the 1.5.0-beta
74
- sweep). When a profiler is actually attached, the observable becomes the
75
- profiler's own cost and the gate itself disappears from the picture. This is
76
- what lets lite-devtools 1.2 / lite-studio 1.2's `watchAllocations` chart
77
- recompute/flush activity alongside the 1.4.0 allocation counters
78
- (`totalAllocations` / `poolGrowths` / `totalDisposals`); only the flush
79
- series requires 1.6.
96
+ observable cost is host-dependent -- on the 2016 Intel MacBook / Node 22 host
97
+ (`bench/results.txt`) KAIROS moves -7% -> -12% and DEEP CHAIN -14% -> -21%
98
+ because the slower frontend can't fully hide a per-iteration predicted branch
99
+ on shapes that iterate 1000-25000 times per rep; on the M4 Pro / Node 26 host
100
+ (`bench/r.txt`) KAIROS actually narrows from -15.7% to -9.9% and BROADCAST
101
+ flips from -1.2% parity to a +12.0% win (fast frontend absorbs the gate
102
+ completely and the underlying propagation shows through). Round-off on
103
+ allocation-dominated shapes on either host (MUX +35%, SELECTIVE DAG +21%,
104
+ DYNAMIC DAG +18% on M4 Pro; +35% / +49% / +43% on Intel). When a profiler is
105
+ actually attached, the observable becomes the profiler's own cost and the
106
+ gate itself disappears from the picture. This is what lets lite-devtools 1.2 /
107
+ lite-studio 1.2's `watchAllocations` chart recompute/flush activity alongside
108
+ the 1.4.0 allocation counters (`totalAllocations` / `poolGrowths` /
109
+ `totalDisposals`); only the flush series requires 1.6.
80
110
 
81
111
  **3) `createScope(fn)` -- the disposable-owner counterpart to `createRoot`.**
82
112
  Runs `fn(dispose)` in a detached, untracked scope and returns whatever `fn`
@@ -618,54 +648,62 @@ None of these touch the reactive engine -- no `FLAG_WATCHER` on `ReactiveNode`,
618
648
 
619
649
  The deliberate engineering for `watch`'s "0 per fire" is the hoisted `untrackedFire` closure with `currentNewValue` shared mutable state -- see source comment in `watch.js`. Inline arrow function inside the effect body would allocate per fire and break the zero-GC contract.
620
650
 
621
- ## Benchmark snapshot (Node 22, 2016-era Intel MacBook Pro, default eager, median across reps -- @1.6.0-alpha.0)
651
+ ## Benchmark snapshot (Node 26.3.1, Apple M4 Pro darwin/arm64, default eager, median across reps -- @1.6.0-alpha.0)
622
652
 
623
- `benchmark.mjs` head-to-head vs alien-signals on app-shaped scenarios (time = median
624
- execution; heap = average transient delta-heap per rep; lite-signal numbers are
625
- @1.6.0-alpha.0, hot paths NOT byte-identical to 1.5 for the first time since 1.2.2 --
626
- 1.6 adds two hook-gated fires: op 6 in `flushEffects` (per pass), op 7 in
627
- `markDownstream`'s inner loop (per enqueued dirty subscriber). Both are branch-
628
- predicted-free when no profiler is attached; the residual cost is one predicted
629
- `null` check per fire site. Third-party engine versions carried forward from the
630
- 1.5.0-beta sweep):
653
+ v3 microscope (`benchmark.mjs`, six first-party shapes, `bench/r.txt`) head-to-head vs
654
+ alien-signals (time = median execution; heap = average transient delta-heap per rep;
655
+ lite-signal numbers are @1.6.0-alpha.0, hot paths NOT byte-identical to 1.5 for the
656
+ first time since 1.2.2 -- 1.6 adds two hook-gated fires: op 6 in `flushEffects` (per
657
+ pass), op 7 in `markDownstream`'s inner loop (per enqueued dirty subscriber). Both
658
+ are branch-predicted-free when no profiler is attached; the residual cost is one
659
+ predicted `null` check per fire site. Third-party engine versions carried forward
660
+ from the 1.5.0-beta sweep. The older Intel MacBook / Node 22 sweep of the same
661
+ 1.6.0-alpha engine is preserved for cross-host reference at `bench/results.txt`):
631
662
 
632
663
  | Scenario | lite vs alien (time) | transient heap (lite / alien) |
633
664
  | -------------------------------- | -------------------- | ----------------------------- |
634
- | SELECTIVE DAG (set churn) | **+49% faster** | 1.6 MB / 29 MB |
635
- | DYNAMIC DAG (FAN=6, read flips) | **+43% faster** | 4.9 MB / 27 MB |
636
- | MUX (256 sigs -> sum -> effect) | **+35% faster** | 38 KB / 3.9 MB |
637
- | SMALL SELECTIVE (~64x6) | **+29% faster** | 0.3 KB / 22.9 MB |
638
- | LARGE WEB APP (~1000x12) | -3% (parity) | 0.3 KB / 41 KB |
639
- | WIDE DENSE (~1000x5) | -6% (parity) | 0.3 KB / 11.6 MB |
640
- | BROADCAST (1 -> 1000 effects) | -10% | 73 KB / 21 KB |
641
- | KAIROS (1 -> 1000 computeds) | -12% | 179 KB / 1.1 MB |
642
- | DEEP CHAIN (256-deep -> effect) | -21% | 18 KB / 942 KB |
643
-
644
- lite-signal's time wins are the allocation-heavy dynamic shapes (object pool allocates
645
- near-nothing; alien churns the nursery), plus MUX fan-in aggregation -- the patterns
646
- that dominate live UI under input churn. **Speed wins vs alien: 4/9** (was 5/9 on
647
- 1.5.0-beta -- LARGE WEB APP flipped back to parity within host noise, +2% -> -3%).
648
- The four wide-aggregation wins (SELECTIVE DAG, DYNAMIC DAG, MUX, SMALL SELECTIVE)
649
- hold their prior magnitudes because the gate is round-off relative to per-iteration
650
- retracking work. Losses widened on the cheapest propagation shapes where every branch
651
- matters: BROADCAST (was -12%, now -10%), KAIROS (was -7%, now -12%), DEEP CHAIN (was
652
- -14%, now -21%). The KAIROS and DEEP CHAIN widening is the observable gate cost --
653
- one predicted `null` check per inner-loop iteration on shapes that iterate 1000-25000
654
- times per rep. When a profiler is actually attached the observable becomes the
655
- profiler's own cost. On allocation, lite wins 8/9 scenarios and is alone in the
656
- zero-alloc band (~0.3 KB transient on the stable app shapes).
657
-
658
- The cross-framework reactivity suite (5 frameworks) re-run on 1.6.0-alpha (default eager,
659
- median-of-10): lite-signal is fastest on all five `dyn:*` rows -- `dyn: large web app`
660
- 536ms (+11% vs alien-signals' 600ms), `dyn: wide dense` 903ms (+4% vs 939ms), plus
661
- simple component (+19%), dynamic component (+13%), deep (+16%) -- with preact 6-19x
662
- slower and vue 15-33x slower on the app-shaped graphs. On the `S: updateComputations`
663
- micro-rows lite trades the lead with alien: **4/7 wins this sweep** (was 7/7 on
664
- 1.5.0-beta) -- the drop is consistent with the gate cost on 50-70ms rows that iterate
665
- many thousands of times per measurement. Retracking verified correct by
666
- `retracking.difftest.mjs` (20,000 direct + 10,000 batched writes, 0 disagreements vs
667
- published 1.1.5). `prealloc: "lazy"` trades a little first-construction allocation on the
668
- dynamic shapes for a smaller resident heap and faster cold start; steady state identical.
665
+ | MUX (256 sigs -> sum -> effect) | **+35.3% faster** | 0 KB / 781 KB (100% less) |
666
+ | SELECTIVE DAG (set churn) | **+20.6% faster** | 7.6 MB / 78.2 MB (10.3x) |
667
+ | DYNAMIC DAG (FAN=6, read flips) | **+17.7% faster** | 3.4 MB / 60.0 MB (17.9x) |
668
+ | BROADCAST (1 -> 1000 effects) | **+12.0% faster** | ~0 KB / ~0 KB (both zero) |
669
+ | KAIROS (1 -> 1000 computeds) | -9.9% | 23 KB / 802 KB (34.3x) |
670
+ | DEEP CHAIN (256-deep -> effect) | -73.8% | 0.5 KB / 1062 KB (>2000x) |
671
+
672
+ lite-signal's time wins on the 1.6.0-alpha M4 Pro sweep cluster on the allocation-heavy
673
+ dynamic shapes (object pool allocates near-nothing; alien churns the nursery), plus MUX
674
+ fan-in aggregation -- the patterns that dominate live UI under input churn.
675
+ **Speed wins vs alien: 4/6** (was 3/6 on 1.5.0-beta -- **BROADCAST flipped to a +12.0%
676
+ win** on this sweep, from -1.2% parity, adding fan-out to the win column). The three
677
+ allocation-heavy wins (MUX / SELECTIVE DAG / DYNAMIC DAG) hold their 1.5.0-beta M4 Pro
678
+ magnitudes within noise because the gate is round-off relative to per-iteration
679
+ retracking work. KAIROS narrowed from -15.7% to -9.9% -- the exact opposite of what
680
+ the 2016 Intel host shows for the same engine (KAIROS -7% -> -12% there), which is
681
+ what you would expect if branch prediction on the M4's frontend is absorbing the two
682
+ hook-gate `null` checks completely. DEEP CHAIN -73.8% is the one shape that stays
683
+ firmly in alien's column and no amount of hook-gate accounting hides that (recursive
684
+ JS-stack computed resolution against a flat chain is the architectural weak spot the
685
+ honest framing has always named). On allocation, lite wins 5/6 shapes and is one to
686
+ four orders of magnitude below alien on every shape where GC pressure exists at all;
687
+ the sixth is a shared-zero on BROADCAST.
688
+
689
+ **The differentiated position is ALLOCATION, not raw propagation speed** -- competitive-
690
+ to-winning throughput with dramatically lower GC pressure, not "fastest dynamic-graph
691
+ engine". That headline reproduces across hosts, sweeps, and third-party version bumps
692
+ because the object pool is the mechanism, not a tuning knob.
693
+
694
+ Mirror sweep (`bench/rb.txt`, Andrii's canonical adapter verbatim, isolated-per-row,
695
+ 10 reps, lite vs alien only on the same M4 Pro host) reproduces the same picture
696
+ across all 47 shapes: lite runs parity-to-behind alien on throughput, wins outright
697
+ on **5/47** (was 4/47 on 1.5.0-beta): `1000x5 - 25 sources (wide dense)` +12.2%,
698
+ `manySourcesIntoOneComputedEffectWithDirect` +31.8%, `manySourcesIntoOneComputedEffect`
699
+ +31.4%, `molBench` +1.0% (new this sweep), and `createComputations4to1` +9.5%. Weak
700
+ on the deep/layered-burst family. Every row carries a `#STAMP` and the counters
701
+ (`nodesRecomputed` / `edgesTraversed` / `sinkReads`) match Andrii's published suite
702
+ exactly, so a lite-vs-alien delta here is identical work, not DCE. Retracking verified
703
+ correct by `retracking.difftest.mjs` (20,000 direct + 10,000 batched writes, 0
704
+ disagreements vs published 1.1.5). `prealloc: "lazy"` trades a little first-construction
705
+ allocation on the dynamic shapes for a smaller resident heap and faster cold start;
706
+ steady state identical.
669
707
 
670
708
  **Andrii Volynets js-reactivity-benchmark position: 4th of 15** with geomean
671
709
  **73.1ms** (was 79.3 on 1.5.0-beta -- own-side improvement + Preact recovered from
@@ -678,7 +716,7 @@ vs @vue/reactivity 1.6x, vs Signia 2.0x, vs MobX 2.3x, vs @solidjs/signals 2.8x,
678
716
  SolidJS 4.2x, vs Preact 1.09x. Raw log: `bench/AndriiVolynetsReactiveBench.log`.
679
717
 
680
718
  Retained heap after forced GC: typically negative for all libs (V8 compacts).
681
- The one exception: lite-signal shows ~+71 KB retained on KAIROS, which is the
719
+ The one exception: lite-signal shows ~+23 KB retained on KAIROS, which is the
682
720
  pre-allocated pool holding the live 1002-node graph in steady state. This is
683
721
  the design: the pool IS the working memory. Not a leak.
684
722
 
@@ -769,11 +807,13 @@ function dumpOwnerTree(handle, depth = 0) {
769
807
  - `test/24-signalbox.test.mjs` -- staged for 1.5.0; all tests `{skip: true}` on 1.2.x.
770
808
  - `test/25-devtools-real-boot.test.mjs` -- 1.2.2: real `Devtools.js` boot against the engine, ghost-contract pin, `stats()` shape pin (10 tests).
771
809
  - `test/26-free-list-invariant.test.mjs` -- 1.2.2: the audit's clean-free-list invariant, asserted by inspecting freshly-allocated nodes (4 tests).
772
- - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
773
- - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
810
+ - `bench/benchmark.mjs` -- anti-DCE throughput harness (microscope; median across reps; raw output `results.txt` on the Intel host, aggregate across four engines `r.txt` on M4 Pro).
811
+ - `bench/mirror.mjs` + `bench/sweep.mjs` -- Andrii's canonical adapter verbatim, cross-framework rows diffing 1:1 against his log; aggregate output `rb.txt` (lite vs alien across 47 shapes, isolated-per-row).
812
+ - `bench/aggregate.mjs` + `bench/report.mjs` -- microscope + mirror aggregators writing `r.txt` / `rb.txt` with `#STAMP` headers (engine + harness sha256, live registry config, host, node).
813
+ - `bench/AndriiVolynetsReactiveBenchScore/AndriiVolynetsReactiveBench.log` -- Andrii's own 15-framework x 47-test log, checked in for audit; the ranking source of truth.
774
814
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
775
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
776
- - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
815
+ - `bench/torture/` -- the complete **17-scenario superset (14 semantic + 3 soak)** behind one runner (`run.mjs`), two groups, forward-compatible through 1.9. Every scenario feature-detects and SKIPS cleanly below the engine version that introduces its feature, so the whole set is safe on the 1.6.0 engine and stays green from 1.4.x forward. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **11 that execute on 1.6.0**: `oracle-fuzzer` (every computed vs an independent uncached reference, 400 seeds x 120 ops), `glitch-hunter` (glitch freedom + exact wakeups), `work-accounting` (minimum body-execution counts over 10 topologies), `op-accounting` (structural work from the `onGraphMutation` opcode lane, not wall-clock), `introspect-torture` (1.6.0: the read-only introspection surface -- `describe`/`nodeId`/`hasObservers`/`isTracking`/`forEachObserver`/`forEachSource`/`forEachOwned`/`ownerOf`/`observeObservers` -- pinning walk-agreement against the reference dep set + op-3/op-4 lane, and the ABA gen-stamp guard on re-walkable descriptors), `concurrent-storm` (8 reentrancy / flush-ordering contracts), `scheduler-storm` (gen-bound thunk ABA guard, FLAG_QUEUED coalescing, throwing-scheduler containment), `box-torture` (1.5.0: signalBox/computedBox interop -- the oracle differential fuzz with every node realised as callable OR box), `scope-torture` (1.6.0: `createScope` adoption contract + the disposal-crash repro and its 300-seed fuzz + `runWithOwner` re-attachment into a scope + pool balance over 200 rounds), `async-torture` (watch / when / whenAsync contracts + a 300-seed projection-guard storm), `capacity-torture` (the fail-closed pool boundary); plus **3 that skip cleanly** as later-version features: `flush-torture` (1.7.0 `flushStrategy`), `cleanup-return-torture` (1.8.0 effect-return cleanup), `dispose-torture` (1.9.0 `Symbol.dispose`). `soak` (wall-clock bound, asserts on RESOURCES; nightly): `graph-fuzzer`, `scheduler-bench`, `torture-soak` -- exit 0 iff zero errors AND post-teardown pool at or below its leaf-only floor AND the JIT sink advanced. Runner spawns each scenario as a child process (several assert on global pool accounting) and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
816
+ - `bench/run-all-bench.sh` -- cold-process-per-engine driver (`FW=<engine>` per child), fed to `aggregate.mjs` for medianing.
777
817
  - `harness/run.mjs` -- dispatcher for the run-on-demand probes (field, dispose, churn, owner, creation, all).
778
818
  - `harness/fieldkit.mjs` -- single-file portable verify + cold-child A/B bench across six shapes.
779
819
  - `harness/churnprobe.mjs` -- topology-churn-per-recompute via onGraphMutation opcodes 3/4 (link add/sever); the 1.11 cone-cache gate.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.6.0-alpha.2",
3
+ "version": "1.6.0-beta",
4
4
  "description": "Zero-GC reactive graph. Monomorphic object pool, versioned push-pull propagation, 32-bit modular versioning. Built for hot paths and long-running processes.",
5
5
  "author": "Zahary Shinikchiev <shinikchiev@yahoo.com>",
6
6
  "license": "MIT",
@@ -47,7 +47,10 @@
47
47
  "profile:burst": "node --expose-gc harness/burst-dag.mjs ./Signal.js",
48
48
  "profile:pull": "node --expose-gc harness/pull-stress.mjs",
49
49
  "verify": "npm test && npm run test:zgc && npm run bench",
50
- "gate": "node harness/VersionMatrix/pre-publish.mjs"
50
+ "gate": "node harness/VersionMatrix/pre-publish.mjs",
51
+ "torture": "node bench/torture/run.mjs",
52
+ "torture:semantic": "node bench/torture/run.mjs --group semantic",
53
+ "torture:soak": "node bench/torture/run.mjs --group soak"
51
54
  },
52
55
  "keywords": [
53
56
  "signal",