@zakkster/lite-signal 1.7.0-alpha.2 → 1.7.0-alpha.4

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,28 @@ 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.7.0-alpha.3] -- 2026-07-27
8
+
9
+ Rolls up the post-`1.7.0-alpha.0` changes into the `alpha.3` tag. The
10
+ flush-strategy feature (`flushStrategy` + `r.flush()`) and the forward-ported
11
+ `getOwner` / `runWithOwner` ship in alpha.0 and are unchanged here; what this cut
12
+ adds is the dangling-cursor crash fix (below), 100% branch coverage on
13
+ `Signal.js`, the completed torture surface for the flush feature, and a
14
+ test-directory cleanup.
15
+
16
+ ### Added -- `flush-torture` now executes on the 1.7.0 engine
17
+
18
+ `bench/torture/`'s `flush-torture` scenario -- present but feature-skipped on the
19
+ 1.5.x / 1.6.x lines -- now **runs**, since `flushStrategy` exists. It pins the
20
+ three modes by a cross-strategy differential (the same graph and op sequence
21
+ under `eager` / `sab` / `manual` must reach identical settled values once
22
+ drained -- they differ only in *when* draining happens), plus per-strategy
23
+ scheduling (eager flushes on `.set()`, sab only at batch exit, manual only on
24
+ `flush()`), re-entrant / empty `flush()`, and the `.subscribe()` contract under
25
+ each strategy. On the 1.7.0 engine the runner therefore executes **12 semantic**
26
+ scenarios and cleanly SKIPS the two later-version ones (`cleanup-return-torture`
27
+ 1.8.0, `dispose-torture` 1.9.0); the suite total is unchanged at **17 (14
28
+ semantic + 3 soak)**.
8
29
 
9
30
  ### Changed -- bench protocol v3 (carried forward)
10
31
 
@@ -32,7 +53,7 @@ one-line cursor repair in `disposeNode` (advance the cursor to the next survivin
32
53
  dep before the free); O(1), disposal path only, no steady-state cost. Pinned by a
33
54
  regression test in `test/12-coverage.test.mjs`.
34
55
 
35
- This also corrects the record on `freeLink`: the `link.source !== null ? … : -1`
56
+ This also corrects the record on `freeLink`: the `link.source !== null ? ... : -1`
36
57
  fallbacks were documented as "unreachable defensive code," but they were in fact
37
58
  reachable -- and *only* reachable -- through this crash path. With the cursor
38
59
  repaired they are genuinely dead, so they were removed (replaced by the passed
@@ -46,9 +67,23 @@ bodies are unchanged.
46
67
 
47
68
  ### Changed -- test file numbering
48
69
 
49
- `test/28-scope.test.mjs` renamed to `test/29-scope.test.mjs` to resolve the
70
+ `test/28-scope.test.mjs` is renamed to `test/29-scope.test.mjs` to resolve the
50
71
  duplicate `28-` prefix it shared with `28-run-with-owner.test.mjs`
51
- (`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`).
72
+ (`createScope` is the 1.6.0 primitive, sequenced after `runWithOwner`). The
73
+ alpha.3 tree had carried *both* files -- the original `28-scope` and a
74
+ byte-identical `29-scope` copy -- so the scope suite was running twice; the stray
75
+ `28-scope.test.mjs` is deleted, leaving one `29-scope.test.mjs`.
76
+
77
+ ### Verified -- full suite green on the 1.7.0 engine (Node 22, `--expose-gc`)
78
+
79
+ - **Torture:** 17/17 -- `torture:semantic` 14/14 (12 executed incl. `flush-torture`,
80
+ 2 clean skips: `cleanup-return` 1.8.0, `dispose` 1.9.0), `torture:soak` 3/3
81
+ (zero errors, every pool back to its leaf-only floor).
82
+ - **Unit:** 485 tests, 465 pass, 0 fail, 1 skip (the architectural SSR N/A in
83
+ `17-reactivity`). The 1 skip aside, the only non-passes are the 19 in
84
+ `test/25-devtools-real-boot`, the real-rig that requires the sibling
85
+ `@zakkster/lite-devtools`; with that sibling resolvable the suite is 484 pass +
86
+ 1 skip. (Engine-only, excluding `test/25`: 466 tests, 465 pass, 1 skip.)
52
87
 
53
88
  ## [1.7.0-alpha.0] -- 2026-07-14
54
89
 
@@ -161,7 +196,7 @@ const FLUSH_ON_BATCH_EXIT = (flushStrategy !== "manual");
161
196
  They are immutable for the registry's lifetime, which gives V8's JIT the
162
197
  constant-folding hook it needs: in `"eager"` mode the emitted code for `.set` is
163
198
  byte-identical to 1.6.0's `if (batchDepth === 0) flushEffects()`; in
164
- `"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE && …` short-circuits on the const-false
199
+ `"sab"`/`"manual"` the `FLUSH_ON_IDLE_WRITE && ...` short-circuits on the const-false
165
200
  and V8 elides the branch entirely after one tier-up. `signal()` additionally
166
201
  selects between **two pre-built `.set` closures at construction time**, so the eager
167
202
  body carries no extra load or branch at all. **Zero behavioural or performance
@@ -178,7 +213,7 @@ a closure-captured `const` boolean lives in a context slot, not as a literal in
178
213
  bytecode, when the body is shared. Splitting the closure at *build* time is what
179
214
  recovered parity. Both dead ends are recorded here so nobody re-derives them.
180
215
 
181
- This is NOT ledger §0b #6 (per-call closure-var load of a primitive V8 can't fold).
216
+ This is NOT ledger S0b #6 (per-call closure-var load of a primitive V8 can't fold).
182
217
  The literals are declared `const` and never reassigned, and the hot body is selected
183
218
  before the first write.
184
219
 
@@ -213,7 +248,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
213
248
  rather than papered over with an ignore pragma (which would have broken the
214
249
  sha256 hot-path proof above for no behavioural gain):
215
250
 
216
- 1-2. `freeLink`'s `link.source !== null ? … : -1` and `link.target !== null ? … : -1`
251
+ 1-2. `freeLink`'s `link.source !== null ? ... : -1` and `link.target !== null ? ... : -1`
217
252
  fallbacks. All three call sites pass a link taken from a live dep/sub list;
218
253
  both endpoints are always non-null.
219
254
  3. The `doubled > maxLinkLimit ? maxLinkLimit : doubled` clamp in the link-growth
@@ -285,7 +320,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
285
320
 
286
321
  Real wins, but smaller than the gap to Reflex on the same shapes. The residual
287
322
  gap is structural (per-write `gen` check, batch-revert epoch tracking, global
288
- version bumping) -- design decisions accepted by §0b and not in scope here.
323
+ version bumping) -- design decisions accepted by S0b and not in scope here.
289
324
  Modern V8's `try/finally` elision varies; expect higher absolute speedups on
290
325
  production V8 than on this sandbox.
291
326
 
@@ -311,17 +346,20 @@ have a declaration.
311
346
  ### Fixed -- documentation had `runWithOwner` marked "not yet shipped"
312
347
 
313
348
  Both `README.md` and `llms.txt` still carried the 1.5.0-era sentence *"the re-attach
314
- companion `runWithOwner` … is not yet shipped"* while the engine exported it. Corrected
349
+ companion `runWithOwner` ... is not yet shipped"* while the engine exported it. Corrected
315
350
  in both, and `flushStrategy` / `flush()` -- previously mentioned nowhere outside the
316
351
  harness notes -- now have a full API-reference section in the README and a Core-concepts
317
352
  entry in `llms.txt`.
318
353
 
319
354
  ### Regenerated -- every published benchmark number
320
355
 
321
- `bench/results.txt`, `bench/resultsReactive.txt`, and both benchmark sections of the
322
- README are rebuilt from the checked-in raw runs (`bench/bench-runs/`,
323
- `bench/bench-runs-reactive/`) rather than carried forward. Two consequences worth
324
- stating out loud:
356
+ The v3 microscope and mirror have been re-run on the 1.7.0-preview engine on **Apple
357
+ M4 Pro darwin/arm64, Node 26.3.1** and their outputs committed to `bench/r.txt`
358
+ (microscope aggregate, 4 engines across the six first-party shapes) and `bench/rb.txt`
359
+ (mirror sweep, Andrii's canonical adapter verbatim, lite vs alien across 47 rows,
360
+ isolated-per-row, 10 reps). Both benchmark sections of the README and the llms.txt
361
+ Benchmark snapshot are rebuilt from these outputs rather than carried forward. Two
362
+ consequences worth stating out loud:
325
363
 
326
364
  - **The headline ranking improved.** On Andrii's 1.7.0 run (`bench/AndriiVolynetsReactiveBench1.7.0.log`,
327
365
  15 frameworks x 47 tests, checked in), lite-signal is **4th of 15 by geomean at
@@ -330,13 +368,19 @@ stating out loud:
330
368
  which was **5.7x behind** the leaders on the 1.1.2 engine Andrii first measured, is
331
369
  now the **fastest result in the entire field**.
332
370
  - **Two local results got worse, and are now stated plainly instead of buried.**
333
- **DEEP CHAIN is a -73% loss to alien-signals** (172 ms vs 99 ms), not the -18% the
371
+ **DEEP CHAIN is a -74.3% loss to alien-signals** (172 ms vs 99 ms), not the -18% the
334
372
  old (invalid) table reported -- it is the engine's largest open performance gap and
335
- it is structural. And **DYNAMIC DAG, while +20% over alien, loses to preact-signals**
336
- (3622 ms vs 3011 ms). The old `resultsReactive.txt` claims "fastest of all five on
337
- every `dyn` row" and "ahead on all seven `updateComputations` rows" do not survive
338
- the re-measurement: it is four of five `dyn` rows (solid takes `simple component`)
339
- and two of seven update rows. Both retracted.
373
+ it is structural. And **DYNAMIC DAG, while +17.0% over alien, loses to preact-signals**
374
+ (3718 ms vs 2760 ms on this sweep). The old `resultsReactive.txt` claims "fastest of
375
+ all five on every `dyn` row" and "ahead on all seven `updateComputations` rows" do
376
+ not survive the re-measurement. Both retracted.
377
+ - **The microscope wins moved slightly since 1.6.0-alpha's M4 Pro sweep.** MUX +32.6%
378
+ (was +35.3%), SELECTIVE DAG +20.4% (was +20.6%), DYNAMIC DAG +17.0% (was +17.7%) --
379
+ same magnitudes, host-noise drift. **BROADCAST narrowed from +12.0% to +6.2%** but
380
+ stayed on the win side of parity, keeping the 4/6 speed-win count. **KAIROS widened
381
+ slightly from -9.9% to -11.7%**. DEEP CHAIN unchanged at -74.3%. Heap column is
382
+ intact: one to four orders of magnitude below alien on every shape where GC pressure
383
+ exists at all.
340
384
 
341
385
  ### Migration
342
386
 
package/README.md CHANGED
@@ -796,31 +796,29 @@ These are the questions you'd ask in a code review, with the answers:
796
796
 
797
797
  > **The pre-1.7.0 numbers in this section were invalid and have been discarded.** Every lite-signal adapter in `bench/benchmark.mjs` built its registry with `flushStrategy: "sab"` while driving un-batched `.set` calls, and the harness never called `batch()` or `flush()`. In SAB mode a `.set` outside a batch *enqueues* effects but does not deliver them -- so the effect ran exactly once, at creation, and never again inside the timed loop. The loop was timing a bare mark-dirty against dead-code-eliminated downstream work; MUX reported 22,032K ops/s against a real ~219K. The harness printed the symptom (`sink=[ ]`, `BENCH_SINK_SUM: 0.00`) on nine of eleven rows and nobody read it. 1.7.0 moves the adapters to **eager** -- the only mode comparable to alien/preact/vue/solid, all of which deliver eagerly -- and adds a **validity guard** that exits non-zero with an `INVALID RUN` block if any scenario finishes with a dead sink. Everything below is from the first honest sweep.
798
798
 
799
- All measurements: **Node 22, Apple M4 Pro (arm64)**, **one engine per cold process**, **median of 10 reps per engine**, lite-signal **@1.7.0-alpha.0** on the default `prealloc: "eager"` / `flushStrategy: "eager"`. Raw reps are checked in under [`bench/bench-runs/`](./bench/bench-runs/) and this table re-derives with `cd bench && node aggregate.mjs`. Note this is a **different host** from every sweep through 1.5.0-beta.0 (a 2016-era Intel MacBook Pro): absolute times are ~2.5-3x faster and do not compare across the boundary. Full per-engine tables: [`bench/results.txt`](./bench/results.txt) (this propagation suite) and [`bench/resultsReactive.txt`](./bench/resultsReactive.txt) (the cross-framework reactivity suite).
799
+ 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, lite-signal **@1.7.0-preview.0** on the default `prealloc: "eager"` / `flushStrategy: "eager"`. Raw reps are checked in under [`bench/bench-runs/`](./bench/bench-runs/) (microscope, six first-party shapes) and [`bench/mirror-runs/`](./bench/mirror-runs/) (mirror, Andrii's canonical 47-shape adapter), and every table re-derives with `cd bench && node aggregate.mjs` / `node report.mjs`. Note this is a **different host** from every sweep through 1.5.0-beta.0 (a 2016-era Intel MacBook Pro / Node 22): absolute times are ~2.5-3x faster and do not compare across the boundary. Full outputs: [`bench/r.txt`](./bench/r.txt) (this microscope aggregate across four engines) and [`bench/rb.txt`](./bench/rb.txt) (the mirror sweep, lite vs alien).
800
800
 
801
801
  | Scenario | What it stresses | lite-signal | alien-signals | lite vs alien | transient heap (lite / alien) |
802
802
  | ---------- | -------------------------------- | ----------- | ------------- | ------------- | ----------------------------- |
803
- | **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **23.5 ms** | 35.6 ms | **+34% faster** | **48.6 KB / 3.9 MB** (81x less) |
804
- | **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **1998 ms** | 2578 ms | **+23% faster** | **5.6 MB / 22.1 MB** (4.0x less) |
805
- | **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **3622 ms** | 4542 ms | **+20% faster** | **3.8 MB / 62.3 MB** (16.4x less) |
806
- | **SMALL SELECTIVE** | 6 layers x 64 wide, 6 cand / 3 read | **804 ms** | 867 ms | **+7% faster** | **1.4 KB / 50.1 MB** (35775x less) |
807
- | **BROADCAST** | 1 signal -> 1000 effects (fan-out) | 435 ms | **410 ms** | -6% | 64.0 KB / 20.2 KB |
808
- | **WIDE DENSE** | 5 layers x ~200 wide, dense fan-in | 1087 ms | **1015 ms** | -7% | **28.6 KB / 28.9 MB** (1010x less) |
809
- | **LARGE WEB APP** | 12 layers x ~80 wide, conditional reads | 1142 ms | **1062 ms** | -8% | **1.4 KB / 2.6 MB** (1889x less) |
810
- | **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 524 ms | **460 ms** | -14% | **201.8 KB / 2.1 MB** (10.6x less) |
811
- | **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 172 ms | **99 ms** | **-73%** | **4.5 KB / 2.7 MB** (591x less) |
803
+ | **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **23.43 ms** | 34.78 ms | **+32.6% faster** | **0 KB / 781 KB** (100% less) |
804
+ | **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **2030 ms** | 2550 ms | **+20.4% faster** | **7.6 MB / 77.0 MB** (90.1% less, 10.1x) |
805
+ | **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **3718 ms** | 4477 ms | **+17.0% faster** | **3.4 MB / 59.8 MB** (94.3% less, 17.6x) |
806
+ | **BROADCAST** | 1 signal -> 1000 effects (fan-out) | **434.81 ms** | 463.64 ms | **+6.2% faster** | ~0 KB / ~0 KB (both fit under GC floor) |
807
+ | **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 516.98 ms | 462.79 ms | -11.7% | **23 KB / 802 KB** (97.1% less, 34.3x) |
808
+ | **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 172.28 ms | **98.83 ms** | -74.3% | **0.5 KB / 1062 KB** (100% less, >2000x) |
812
809
 
813
810
  *(lower time = faster; transient heap = average delta-heap per rep, lower = less GC pressure)*
814
811
 
815
- **Reading the table -- including the parts that don't flatter the engine.** lite-signal's time wins cluster exactly where its zero-GC design pays off: **fan-in aggregation (MUX +34%)** and the **allocation-heavy dynamic shapes** (SELECTIVE DAG +23%, DYNAMIC DAG +20%, SMALL SELECTIVE +7%), where alien-signals churns the nursery and the object pool allocates near-nothing. That is **4 wins of 9**. The five losses are real and two of them are large:
812
+ **Reading the table -- including the parts that don't flatter the engine.** lite-signal's time wins cluster exactly where its zero-GC design pays off: **fan-in aggregation (MUX +32.6%)** and the **allocation-heavy dynamic shapes** (SELECTIVE DAG +20.4%, DYNAMIC DAG +17.0%), where alien-signals churns the nursery and the object pool allocates near-nothing, plus **BROADCAST +6.2%** (narrowed from +12.0% on 1.6.0-alpha but still on the win side of parity). That is **4 wins of 6**. The two losses are real:
816
813
 
817
- - **DEEP CHAIN (-73%)** is the engine's structurally worst shape and the largest open performance gap it has. On a 256-deep pull chain alien's flatter representation wins outright (99 ms vs 172 ms), and this host's faster memory subsystem rewards that layout *more* than the old Intel box did -- the gap widened from the -14% the (already-suspect) 1.5.0-beta table reported. It is not closed and it is not going to be closed by tuning.
818
- - **DYNAMIC DAG** is a +20% win over alien but a **loss to preact-signals** (3622 ms vs preact's 3011 ms). preact is not the reference column here, but it beats lite on that row.
819
- - **KAIROS (-14%)** widened from parity: 1 source -> 1000 computeds has almost nothing to retrack, so the pooled representation pays its per-node indirection with no allocation saving to show for it.
814
+ - **DEEP CHAIN (-74.3%)** is the engine's structurally worst shape and the largest open performance gap it has. On a 256-deep pull chain alien's flatter representation wins outright (99 ms vs 172 ms), and this host's faster memory subsystem rewards that layout *more* than the old Intel box did -- the gap widened from the -14% the (already-suspect) 1.5.0-beta table reported. It is not closed and it is not going to be closed by tuning. Note the inversion: **lite loses the row on time by 74% while allocating >2000x less heap**.
815
+ - **KAIROS (-11.7%)** widened slightly from -9.9% on 1.6.0-alpha: 1 source -> 1000 computeds has almost nothing to retrack, so the pooled representation pays its per-node indirection with no allocation saving to show for it.
820
816
 
821
- On **allocation pressure** lite-signal wins **8 of 9** and is alone in the zero-alloc band: **~1.4 KB** of transient garbage across an entire run on the stable app shapes (LARGE WEB APP, SMALL SELECTIVE) against alien's 2.6 MB and 50.1 MB. The one loss is **BROADCAST** (64 KB vs alien's 20 KB), a pure fan-out with no retracking for the pool to amortize -- still 19x under preact's 1.2 MB on the same shape.
817
+ On **allocation pressure** lite-signal wins **5 of 6** and is one to four orders of magnitude below alien on every shape where GC pressure exists at all: 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 59.8 MB (17.6x), SELECTIVE DAG 7.6 MB vs 77.0 MB (10.1x). 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 ~16 MB on SELECTIVE DAG where lite allocates 0 KB and 7.6 MB respectively (`bench/r.txt`).
822
818
 
823
- DEEP CHAIN is the honest summary of the whole trade in one row: **lite loses the row on time by 73% while allocating 591x less heap.** Both numbers are true, and neither cancels the other. If your workload is a long pull chain and you can afford GC pauses, use alien-signals. If you cannot afford GC at all -- a 16 ms frame budget, a multi-day extension session -- that is the deal on offer.
819
+ DEEP CHAIN is the honest summary of the whole trade in one row: **lite loses the row on time by 74% while allocating >2000x less heap.** Both numbers are true, and neither cancels the other. If your workload is a long pull chain and you can afford GC pauses, use alien-signals. If you cannot afford GC at all -- a 16 ms frame budget, a multi-day extension session -- that is the deal on offer.
820
+
821
+ 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 **4 of the 47** (`1000x5 - 25 sources (wide dense)` +11.7%, both `manySourcesIntoOne*ComputedEffect` fan-ins ~+31%, and `molBench` +1.8%), 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.
824
822
 
825
823
  > Note on the retained heap lite-signal shows on KAIROS: that is 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](#the-case-for-object-pooling).
826
824
 
@@ -898,7 +896,7 @@ The two uncovered branch arms in `Signal.js` are **unreachable by construction**
898
896
  - The `doubled > maxLinkLimit ? maxLinkLimit : doubled` clamp in the link-growth ledger (1 arm). `maxLinkLimit` is `maxLinks * 16` and the ledger only ever doubles from `maxLinks`, so the doubling sequence lands *exactly* on the ceiling and can never overshoot it. The ceiling is still a real wall -- `26`/`12-coverage` prove the `CapacityError` -- it is only the *clamp* that is dead.
899
897
  - The `if (batchEpoch === 0) batchEpoch = 1;` 32-bit-wraparound guard in `batch()` (1 arm). Reaching it requires 2^32 batches in one registry.
900
898
 
901
- > Historical note: earlier releases listed a third item here -- `freeLink`'s `link.source !== null ? … : -1` fallbacks -- as "pure defensive code, unreachable by construction." That was wrong. Those arms *were* reachable, and only reachable, through a crash: disposing a source from inside an observer whose re-tracking cursor was still parked on that source's link left `disposeNode` freeing a link the cursor pointed at, and `severTail` then null-dereferenced in `freeLink`. Fixed with a one-line cursor repair in `disposeNode`; the fallbacks are now genuinely dead and were removed (replaced by the always-live `source.id` / `target.id`). The crash path is pinned by a regression test in `12-coverage`.
899
+ > Historical note: earlier releases listed a third item here -- `freeLink`'s `link.source !== null ? ... : -1` fallbacks -- as "pure defensive code, unreachable by construction." That was wrong. Those arms *were* reachable, and only reachable, through a crash: disposing a source from inside an observer whose re-tracking cursor was still parked on that source's link left `disposeNode` freeing a link the cursor pointed at, and `severTail` then null-dereferenced in `freeLink`. Fixed with a one-line cursor repair in `disposeNode`; the fallbacks are now genuinely dead and were removed (replaced by the always-live `source.id` / `target.id`). The crash path is pinned by a regression test in `12-coverage`.
902
900
 
903
901
  Rather than papering over these with an ignore pragma, they are listed here. `Signal.js` is sha256-pinned across the 1.6 -> 1.7 boundary on eleven hot-path function bodies; adding coverage pragmas to it would have broken that proof for no behavioural gain.
904
902
 
@@ -919,7 +917,7 @@ npm run test:gc
919
917
 
920
918
  ### Tier 3 -- Performance (comparative benchmark)
921
919
 
922
- `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).
920
+ `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes; the aggregate output is [`bench/r.txt`](./bench/r.txt) (four engines: lite, alien, preact, solid). 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).
923
921
 
924
922
  **As of 1.7.0 the propagation harness fails loudly instead of lying quietly.** Every scenario's anti-DCE sink is checked after the timed loop; a dead sink prints an `INVALID RUN` block naming the offending rows and exits non-zero. This is the guard that would have caught the pre-1.7.0 `flushStrategy: "sab"`-without-flush bug on day one -- see the note at the top of [Benchmarks](#benchmarks).
925
923
 
@@ -927,9 +925,56 @@ npm run test:gc
927
925
  npm run bench
928
926
  ```
929
927
 
930
- ### Tier 4 -- Torture soaks (crash detection under chaos)
928
+ ### Tier 4 -- Torture (correctness and resources under chaos)
929
+
930
+ `bench/torture/` holds the complete **17-scenario superset (14 semantic + 3
931
+ soak)** behind one runner (`run.mjs`), the forward-compatible set through 1.9.
932
+ They are not perf benchmarks: the ops/sec figures reflect random workload
933
+ composition, not engine throughput -- `bench/benchmark.mjs` remains the canonical
934
+ perf harness. Every scenario feature-detects and **skips cleanly** below the
935
+ engine version that introduces its feature, so on the 1.7.0 engine the runner
936
+ executes **12 semantic** scenarios (including `flush-torture`) and reports a clean
937
+ SKIP for the two later-version ones (`cleanup-return-torture` 1.8.0,
938
+ `dispose-torture` 1.9.0).
939
+
940
+ ```bash
941
+ npm run torture # everything
942
+ npm run torture:semantic # correctness only, CI-shaped
943
+ npm run torture:soak # resource soaks only
944
+ node bench/torture/run.mjs --list
945
+ ```
931
946
 
932
- `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:
947
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
948
+
949
+ Run these on every commit. The nine untagged scenarios run on any 1.4.x+ engine;
950
+ `box-torture` (1.5.0), `scope-torture` (1.6.0), and `flush-torture` (1.7.0) run
951
+ here because their features exist; the two tagged `1.8.0+`/`1.9.0+` feature-detect
952
+ and SKIP on this engine.
953
+
954
+ | scenario | pins |
955
+ | -------- | ---- |
956
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
957
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
958
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies |
959
+ | `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
960
+ | `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 |
961
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts |
962
+ | `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
963
+ | `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
964
+ | `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 |
965
+ | `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
966
+ | `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary |
967
+ | `flush-torture` (1.7.0) | the three `flushStrategy` modes by cross-strategy differential (same graph + op sequence under eager/sab/manual settling to identical values), per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each |
968
+ | `cleanup-return-torture` (1.8.0+) | an effect's returned cleanup: timing, compose order, self-dispose guard -- SKIP on 1.7.0 |
969
+ | `dispose-torture` (1.9.0+) | `Symbol.dispose` / `using` on lifecycle objects -- SKIP on 1.7.0 |
970
+
971
+ #### `soak` -- wall-clock bound, asserts on **resources**
972
+
973
+ Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
974
+ and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
975
+ effect rewires, nested-batch + untrack reads, and microtask-scheduled async
976
+ flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
977
+ failure:
933
978
 
934
979
  - zero thrown exceptions during the run, and
935
980
  - after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn).
@@ -968,7 +1013,7 @@ Through **v1.1.2**, that came with a mathematical trade-off: while memory alloca
968
1013
  **1.7.0 on the official [js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark) (15 libraries, 47 tests, raw log checked in at [`bench/AndriiVolynetsReactiveBench1.7.0.log`](./bench/AndriiVolynetsReactiveBench1.7.0.log)):** `lite-signal` holds **4th overall by geomean (71.5 ms)**, behind alien-signals (44.2, the field leader -- lite runs at 0.62x), reflex (51.5), and @reactively (56.8), and now **20% ahead of 5th-place Preact Signals (85.7)** -- a gap that widened from ~5% on the 1.3.0 run. It finishes **top-3 on 21 of 47 tests** and is the **outright fastest of all 15** on four: `manyEffectsFromOneSource`, `manySourcesIntoOneComputedEffect`, `updateComputations2to1`, and the `1000x5 - 25 sources` wide-dense DAG. It remains the only object-pooled, zero-GC engine in the field.
969
1014
 
970
1015
  #### 1. Stable Topologies (Fan-in / Fan-out / Broadcast)
971
- In stable environments (game engines, particle systems, visualizers), `lite-signal` maintains a near-zero allocation profile and keeps frame times flat -- unchanged through 1.7.0. On fan-in it is the fastest engine in the field (MUX +34% vs alien on the local harness; fastest of all 15 on Andrii's `manySourcesIntoOneComputedEffect`).
1016
+ In stable environments (game engines, particle systems, visualizers), `lite-signal` maintains a near-zero allocation profile and keeps frame times flat -- unchanged through 1.7.0. On fan-in it is the fastest engine in the field (MUX +32.6% vs alien on the local microscope; fastest of all 15 on Andrii's `manySourcesIntoOneComputedEffect`).
972
1017
 
973
1018
  #### 2. Dynamic Topologies (Web Apps / Layered DAGs) -- closed in 1.1.4, and it stayed closed
974
1019
 
@@ -988,22 +1033,21 @@ In stable environments (game engines, particle systems, visualizers), `lite-sign
988
1033
 
989
1034
  The 3.4x-11x deficits of 1.1.2 are gone. The wide-dense shape -- the worst of the three in 1.1.2, at 5.7x behind -- is now the fastest result in the entire field.
990
1035
 
991
- *1.7.0 (default eager) on the local propagation harness (Apple M4 Pro, one engine per cold process; compare within-column, lite vs alien):*
992
- | Scenario | alien-signals | lite-signal (1.7.0) | result |
1036
+ *1.7.0-preview (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):*
1037
+ | Scenario | alien-signals | lite-signal (1.7.0-preview) | result |
993
1038
  | :--- | :--- | :--- | :--- |
994
- | **MUX** (256 -> 1 fan-in) | 35.6ms | 23.5ms | **lite +34%** |
995
- | **SELECTIVE DAG** (sqrt-layered, set churn) | 2578ms | 1998ms | **lite +23%** |
996
- | **DYNAMIC DAG** (sqrt-layered, FAN=6) | 4542ms | 3622ms | **lite +20%** |
997
- | **SMALL SELECTIVE** (~ 64x6) | 867ms | 804ms | **lite +7%** |
998
- | **WIDE DENSE** (~ 1000x5) | 1015ms | 1087ms | alien +7% |
999
- | **LARGE WEB APP** (~ 1000x12) | 1062ms | 1142ms | alien +8% |
1000
- | **DEEP CHAIN** (256-deep pull) | 99ms | 172ms | **alien +73%** |
1039
+ | **MUX** (256 sigs -> sum -> effect) | 34.78 ms | 23.43 ms | **lite +32.6%** |
1040
+ | **SELECTIVE DAG** (sqrt-layered, set churn) | 2550 ms | 2030 ms | **lite +20.4%** |
1041
+ | **DYNAMIC DAG** (sqrt-layered, FAN=6) | 4477 ms | 3718 ms | **lite +17.0%** |
1042
+ | **BROADCAST** (1 -> 1000 effects) | 463.64 ms | 434.81 ms | **lite +6.2%** (narrowed from +12.0% on 1.6.0-alpha) |
1043
+ | **KAIROS** (1 -> 1000 computeds) | 462.79 ms | 516.98 ms | alien +11.7% (widened slightly from -9.9% on 1.6.0-alpha) |
1044
+ | **DEEP CHAIN** (256-deep pull) | 98.83 ms | 172.28 ms | **alien +74.3%** |
1001
1045
 
1002
- > **Honest note (1.7.0):** these are the first *valid* numbers this harness has produced -- every sweep before 1.7.0 timed a dead sink (see [Benchmarks](#benchmarks)). Two results are worse than the old, invalid table claimed: **DEEP CHAIN is a -73% loss**, not -18%, and it is the largest open performance gap the engine has; and **DYNAMIC DAG, while a +20% win over alien, is a loss to preact-signals** (3622ms vs 3011ms). lite remains the only zero-alloc library on every stable scenario and still wins 4 of 9 on time and 8 of 9 on heap (see [`bench/results.txt`](./bench/results.txt)).
1046
+ > **Honest note (1.7.0-preview):** these numbers come from the first *valid* microscope this harness has produced -- every sweep before 1.7.0 timed a dead sink (see [Benchmarks](#benchmarks)). Two results are worse than the old, invalid table claimed: **DEEP CHAIN is a -74.3% loss** (not -18%), and it is the largest open performance gap the engine has, and **DYNAMIC DAG, while a +17.0% win over alien, is a loss to preact-signals** (3718 ms vs preact's 2760 ms on this sweep -- see `bench/r.txt`). lite still wins 4/6 on time (MUX, SELECTIVE DAG, DYNAMIC DAG, BROADCAST) and 5/6 on heap; the sixth is a shared-zero on BROADCAST. lite remains one to four orders of magnitude below alien on transient heap on every shape where GC pressure exists at all.
1003
1047
 
1004
- The cross-framework reactivity suite agrees on the shape of the result (median of 10, [`bench/resultsReactive.txt`](./bench/resultsReactive.txt)): lite-signal is the **fastest of five frameworks on four of the five `dyn` rows** -- `dyn: wide dense` **283ms** (+31% vs alien), `dyn: large web app` **231ms** (+17%), `dyn: dynamic component` **130ms** (+16%), `dyn: deep` **114ms** (+3%) -- with preact 4.6-8.5x slower and vue 9.5-12.6x slower on the app-shaped graphs. Solid takes the fifth row (`dyn: simple component`, 148ms vs lite's 164ms). On the `S: createComputations*` construction rows lite is slower on all nine -- the documented price of the object pool, for which `signalBox` / `computedBox` are the ~1.9x-cheaper mitigation. The retracking is verified correct by `harness/retracking.difftest.mjs` -- 20,000 direct + 10,000 batched writes, 0 disagreements against the published reference engine.
1048
+ 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 **4/47** (`1000x5 - 25 sources (wide dense)` +11.7%, `manySourcesIntoOneComputedEffectWithDirect` +31.8%, `manySourcesIntoOneComputedEffect` +30.7%, and `molBench` +1.8%), 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 `harness/retracking.difftest.mjs` -- 20,000 direct + 10,000 batched writes, 0 disagreements against the published reference engine.
1005
1049
 
1006
- **The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.7.0 holds the line -- the engine ranks **4th of 15** on the official js-reactivity-benchmark and is the only zero-GC library in the field. `lite-signal` keeps the zero-GC, flat-arena profile for 120fps Canvas/WebGL **and** wins on the high-churn dynamic and fan-in topologies that dominate live UI. It runs at parity-to-slightly-behind on cheap stable shapes. The one shape where alien's flatter representation leads decisively is the **256-deep computed pipeline (DEEP CHAIN, -73%)** -- and that gap is structural, not a tuning bug.
1050
+ **The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.7.0-preview holds the line -- the engine ranks **4th of 15** on the official js-reactivity-benchmark and is the only zero-GC library in the field. `lite-signal` keeps the zero-GC, flat-arena profile for 120fps Canvas/WebGL **and** wins on the high-churn dynamic and fan-in topologies that dominate live UI. It runs at parity-to-slightly-behind on cheap stable shapes. The one shape where alien's flatter representation leads decisively is the **256-deep computed pipeline (DEEP CHAIN, -74.3%)** -- and that gap is structural, not a tuning bug.
1007
1051
 
1008
1052
  ### Roadmap
1009
1053
  - **1.1.5** -- additions in service of `lite-devtools` (node identity/traversability on the introspection walkers, for full auto-discovered graph rendering). *Shipped.*
@@ -1378,7 +1422,7 @@ npm test # behaviour suite: 476 tests, 29 files, ~5s
1378
1422
  npm run test:gc # all 484 -- adds --expose-gc (8 tests are gated on it)
1379
1423
  npm run test:coverage # the same suite under c8 (100% stmts / 100% funcs / 100% branch)
1380
1424
  npm run test:harness # profiler-tools hardening suite
1381
- npm run bench # comparative benchmark vs alien-signals -> bench/results.txt
1425
+ npm run bench # microscope + mirror comparative benches (r.txt / rb.txt)
1382
1426
  node --expose-gc bench/mirror.mjs --self-verify # cross-framework mirror sweep (bench protocol v3)
1383
1427
  npm run harness:smoke # flushStrategy semantics (eager/sab/manual) -- ASSERTS
1384
1428
  npm run harness:all # smoke + field + dispose + churn probes
package/Signal.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @zakkster/lite-signal v1.7.0
2
+ * @zakkster/lite-signal v1.7.0-alpha.3
3
3
  * --------------------
4
4
  * 1.7.0 -- flushStrategy: registry-level effect-delivery policy.
5
5
  *
@@ -23,7 +23,7 @@
23
23
  * closure captures a constant function reference for its lifetime; V8 inlines the
24
24
  * monomorphic target. In "eager" mode the inlined body is byte-identical to the
25
25
  * 1.6.0 inline check (`if (batchDepth === 0) flushEffects()`), preserving the
26
- * §0b ledger #6 verdict (per-call closure-var loads are forbidden -- a hoisted
26
+ * S0b ledger #6 verdict (per-call closure-var loads are forbidden -- a hoisted
27
27
  * function reference + monomorphic inlining is not the same mechanism).
28
28
  *
29
29
  * Original 1.6.0 header follows.
package/llms.txt CHANGED
@@ -59,8 +59,17 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
59
59
 
60
60
  ## Version notes
61
61
 
62
- - **1.7.0-alpha** (current): the **flush-strategy minor**. Two engine additions and
63
- one large tooling correction.
62
+ - **1.7.0-alpha.3** (current): the **flush-strategy minor**. Two engine additions and
63
+ one large tooling correction (all shipped in alpha.0, below); `alpha.3` rolls up
64
+ the dangling-cursor crash fix (a one-line `disposeNode` cursor repair; the
65
+ `freeLink` `-1` fallbacks it made dead were removed and branch coverage on
66
+ `Signal.js` closed to **100%**), `flush-torture` now executing on this engine
67
+ (so the runner runs **12 semantic** + 2 skip -- `cleanup-return` 1.8.0,
68
+ `dispose` 1.9.0 -- of the 17-scenario suite), and the removal of a byte-identical
69
+ duplicate `test/28-scope.test.mjs` (the scope suite had been running twice; the
70
+ correctly-numbered `29-scope.test.mjs` remains). Verified green: torture 17/17;
71
+ unit **485 tests, 465 pass, 0 fail, 1 skip** (SSR N/A) -- 484 pass with the
72
+ sibling `@zakkster/lite-devtools` the 19-test `test/25` rig needs.
64
73
 
65
74
  **1) `flushStrategy` + `r.flush()`** -- per-registry control over *when* effects
66
75
  deliver (`"eager"` default | `"sab"` | `"manual"`), plus an explicit `flush()` on
@@ -589,58 +598,60 @@ None of these touch the reactive engine -- no `FLAG_WATCHER` on `ReactiveNode`,
589
598
 
590
599
  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.
591
600
 
592
- ## Benchmark snapshot (Node 22, Apple M4 Pro, default eager, median of 10 isolated per-engine runs -- @1.7.0-alpha.0)
601
+ ## Benchmark snapshot (Node 26.3.1, Apple M4 Pro darwin/arm64, default eager, median across reps -- @1.7.0-preview.0)
593
602
 
594
603
  **Every pre-1.7.0 number from this harness is void** -- the lite-signal adapters ran
595
604
  `flushStrategy: "sab"` without ever calling `batch()` or `flush()`, so the timed loop
596
605
  was measuring a dead sink (see Version notes). What follows is the first valid sweep.
597
- The host is also new (Apple M4 Pro, not the 2016 Intel MacBook of every prior table):
598
- absolute times are ~2.5-3x faster and do not compare across the boundary.
606
+ The host is also new (Apple M4 Pro / Node 26, not the 2016 Intel MacBook / Node 22 of
607
+ every prior table): absolute times are ~2.5-3x faster and do not compare across the
608
+ boundary.
599
609
 
600
- `benchmark.mjs` head-to-head vs alien-signals (time = median execution across 10 cold
601
- per-engine processes; heap = average transient delta-heap per rep):
610
+ v3 microscope (`benchmark.mjs`, six first-party shapes, `bench/r.txt`) head-to-head vs
611
+ alien-signals (time = median execution; heap = average transient delta-heap per rep):
602
612
 
603
613
  | Scenario | lite | alien | lite vs alien (time) | transient heap (lite / alien) |
604
614
  | -------------------------------- | -------- | -------- | -------------------- | ----------------------------- |
605
- | MUX (256 sigs -> sum -> effect) | 23.5 ms | 35.6 ms | **+34% faster** | 48.6 KB / 3.9 MB |
606
- | SELECTIVE DAG (set churn) | 1998 ms | 2578 ms | **+23% faster** | 5.6 MB / 22.1 MB |
607
- | DYNAMIC DAG (FAN=6, read flips) | 3622 ms | 4542 ms | **+20% faster** | 3.8 MB / 62.3 MB |
608
- | SMALL SELECTIVE (~64x6) | 804 ms | 867 ms | **+7% faster** | 1.4 KB / 50.1 MB |
609
- | BROADCAST (1 -> 1000 effects) | 435 ms | 410 ms | -6% | 64.0 KB / 20.2 KB |
610
- | WIDE DENSE (~1000x5) | 1087 ms | 1015 ms | -7% | 28.6 KB / 28.9 MB |
611
- | LARGE WEB APP (~1000x12) | 1142 ms | 1062 ms | -8% | 1.4 KB / 2.6 MB |
612
- | KAIROS (1 -> 1000 computeds) | 524 ms | 460 ms | -14% | 201.8 KB / 2.1 MB |
613
- | DEEP CHAIN (256-deep -> effect) | 172 ms | 99 ms | **-73%** | 4.5 KB / 2.7 MB |
614
-
615
- Time: lite wins 4 of 9 -- fan-in (MUX) and the allocation-heavy dynamic shapes, exactly
616
- where the object pool's zero allocation converts into a GC tailwind that alien (which
617
- churns the nursery) does not get. Heap: lite wins 8 of 9 and is alone in the zero-alloc
618
- band (~1.4 KB transient across an entire run on the stable app shapes).
615
+ | MUX (256 sigs -> sum -> effect) | 23.43 ms | 34.78 ms | **+32.6% faster** | 0 KB / 781 KB (100% less) |
616
+ | SELECTIVE DAG (set churn) | 2030 ms | 2550 ms | **+20.4% faster** | 7.6 MB / 77.0 MB (10.1x) |
617
+ | DYNAMIC DAG (FAN=6, read flips) | 3718 ms | 4477 ms | **+17.0% faster** | 3.4 MB / 59.8 MB (17.6x) |
618
+ | BROADCAST (1 -> 1000 effects) | 434.81 ms | 463.64 ms | **+6.2% faster** | ~0 KB / ~0 KB (both zero) |
619
+ | KAIROS (1 -> 1000 computeds) | 516.98 ms | 462.79 ms | -11.7% | 23 KB / 802 KB (34.3x) |
620
+ | DEEP CHAIN (256-deep -> effect) | 172.28 ms | 98.83 ms | **-74.3%** | 0.5 KB / 1062 KB (>2000x) |
621
+
622
+ Time: lite wins 4 of 6 -- fan-in (MUX), the allocation-heavy dynamic shapes, plus
623
+ BROADCAST +6.2% (narrowed from +12.0% on 1.6.0-alpha but still on the win side of
624
+ parity), exactly where the object pool's zero allocation converts into a GC tailwind
625
+ that alien (which churns the nursery) does not get. Heap: lite wins 5 of 6 and is one
626
+ to four orders of magnitude below alien on every shape where GC pressure exists at
627
+ all; the sixth is a shared-zero on BROADCAST.
619
628
 
620
629
  **The two losses that matter, stated plainly:**
621
- - **DEEP CHAIN -73%.** The 256-deep pull chain is the engine's structurally worst shape
622
- and its largest open performance gap. alien's flatter representation wins when the
623
- propagation path is long rather than wide. The gap WIDENED on this host (it was
624
- reported as -18% under the old, invalid harness). It is not a tuning bug and it is
625
- not closed. Note the inversion: lite loses the row on time by 73% while allocating
626
- 591x less heap. Both are true.
627
- - **DYNAMIC DAG loses to preact-signals** (3622 ms vs preact's 3011 ms), even while
628
- beating alien by 20%. preact is not the reference column, but it wins that row.
629
- - BROADCAST is the one heap loss (64 KB vs alien's 20 KB): a pure fan-out with no
630
- retracking for the pool to amortize. Still 19x under preact's 1.2 MB on the shape.
631
-
632
- Cross-framework reactivity suite, median of 10 (`bench/resultsReactive.txt`):
633
- lite-signal is the fastest of five on **four of the five `dyn` rows** --
634
- `dyn: wide dense` 283 ms (+31% vs alien), `dyn: large web app` 231 ms (+17%),
635
- `dyn: dynamic component` 130 ms (+16%), `dyn: deep` 114 ms (+3%) -- with preact 4.6-8.5x
636
- and vue 9.5-12.6x slower on the app-shaped graphs. Solid takes the fifth
637
- (`dyn: simple component`, 148 ms vs lite's 164 ms). lite is slower on all nine
638
- `S: createComputations*` construction rows (worst: `1000to1`, 49 ms vs alien's 27 ms) --
639
- the documented price of the object pool, for which `signalBox` / `computedBox` are the
640
- ~1.9x-cheaper mitigation. Caveat on this suite: `run-all-reactive.sh` runs all five
641
- engines in ONE process per run (10 runs, 60s cooldown), so it is thermally clean but
642
- NOT isolated from cross-engine inline-cache pollution. Treat its within-row deltas as
643
- indicative; `bench/results.txt` is the isolated protocol.
630
+ - **DEEP CHAIN -74.3%.** The 256-deep pull chain is the engine's structurally worst
631
+ shape and its largest open performance gap. alien's flatter representation wins when
632
+ the propagation path is long rather than wide. The gap WIDENED on this host (it was
633
+ reported as -18% under the old, invalid harness, -14% on the older Intel host). It
634
+ is not a tuning bug and it is not closed. Note the inversion: lite loses the row on
635
+ time by 74% while allocating >2000x less heap. Both are true.
636
+ - **KAIROS -11.7%** widened slightly from -9.9% on 1.6.0-alpha: 1 source -> 1000
637
+ computeds has almost nothing to retrack, so the pooled representation pays its
638
+ per-node indirection with no allocation saving to show for it.
639
+
640
+ **The differentiated position is ALLOCATION, not raw propagation speed** -- competitive-
641
+ to-winning throughput with dramatically lower GC pressure, not "fastest dynamic-graph
642
+ engine". That headline reproduces across hosts, sweeps, and third-party version bumps
643
+ because the object pool is the mechanism, not a tuning knob.
644
+
645
+ Mirror sweep (`bench/rb.txt`, Andrii's canonical adapter verbatim, isolated-per-row,
646
+ 10 reps, lite vs alien only on the same M4 Pro host) reproduces the same picture
647
+ across all 47 shapes: lite runs parity-to-behind alien on throughput, wins outright
648
+ on **4/47**: `1000x5 - 25 sources (wide dense)` +11.7%,
649
+ `manySourcesIntoOneComputedEffectWithDirect` +31.8%, `manySourcesIntoOneComputedEffect`
650
+ +30.7%, and `molBench` +1.8%. Weak on the deep/layered-burst family. Every row carries
651
+ a `#STAMP` and the counters (`nodesRecomputed` / `edgesTraversed` / `sinkReads`) match
652
+ Andrii's published suite exactly, so a lite-vs-alien delta here is identical work,
653
+ not DCE. Retracking verified correct by `harness/retracking.difftest.mjs` (20,000
654
+ direct + 10,000 batched writes, 0 disagreements vs the published reference engine).
644
655
 
645
656
  Independent ranking (Andrii Volynets' js-reactivity-benchmark fork, 15 frameworks,
646
657
  47 tests, raw log at `bench/AndriiVolynetsReactiveBench1.7.0.log`): lite-signal is
@@ -654,7 +665,7 @@ geomean: @vue/reactivity 1.62x, Oby 1.73x, Signia 1.76x, MobX 2.40x, s-js 2.57x,
654
665
  engine in the field.
655
666
 
656
667
  Retained heap after forced GC: typically negative for all libs (V8 compacts).
657
- The one exception: lite-signal shows a positive retained figure on KAIROS, which is the
668
+ The one exception: lite-signal shows ~+23 KB retained on KAIROS, which is the
658
669
  pre-allocated pool holding the live 1002-node graph in steady state. This is the design:
659
670
  the pool IS the working memory. Not a leak.
660
671
 
@@ -767,9 +778,9 @@ function dumpOwnerTree(handle, depth = 0) {
767
778
  - `test/29-scope.test.mjs` (4) -- `createScope` (1.6.0), the adopting counterpart to `createRoot`.
768
779
  NOTE: `28-run-with-owner` and `29-scope` collide on the `28-` prefix. Both are live; one should be renumbered to `29-`.
769
780
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
770
- - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
781
+ - `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).
771
782
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
772
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
783
+ - `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.7.0 engine and stays green from 1.4.x forward. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit) -- the **12 that execute on 1.7.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: read-only introspection surface -- `describe`/`nodeId`/`hasObservers`/`isTracking`/`forEach*`/`ownerOf`/`observeObservers` -- walk-agreement + the ABA gen-stamp guard), `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 + disposal-crash fuzz + `runWithOwner` re-attachment), `async-torture` (watch / when / whenAsync contracts + a 300-seed projection-guard storm), `capacity-torture` (the fail-closed pool boundary), `flush-torture` (1.7.0: the three `flushStrategy` modes by cross-strategy differential -- same graph + op sequence under eager/sab/manual reaching identical settled values -- plus per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each); plus **2 that skip cleanly** as later-version features: `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`.
773
784
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
774
785
  - `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
775
786
  - `harness/smoke.mjs` -- 1.7 flushStrategy semantics (eager/sab/manual) + `flush()`; ASSERTS, so it fails loudly on a regression. First in `harness:all` and `verify`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.7.0-alpha.2",
3
+ "version": "1.7.0-alpha.4",
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",
@@ -45,7 +45,10 @@
45
45
  "profile:burst": "node --expose-gc harness/burst-dag.mjs ./Signal.js",
46
46
  "profile:pull": "node --expose-gc harness/pull-stress.mjs",
47
47
  "gate": "node harness/VersionMatrix/pre-publish.mjs",
48
- "verify": "npm test && npm run harness:smoke && npm run bench"
48
+ "verify": "npm test && npm run harness:smoke && npm run bench",
49
+ "torture": "node bench/torture/run.mjs",
50
+ "torture:semantic": "node bench/torture/run.mjs --group semantic",
51
+ "torture:soak": "node bench/torture/run.mjs --group soak"
49
52
  },
50
53
  "keywords": [
51
54
  "signal",