@zakkster/lite-signal 1.5.0-beta.6 → 1.5.0-beta.8

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,55 @@ 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.5.0-beta.8] -- 2026-07-22
8
+
9
+ ### Added -- `box-torture`, and the torture suite reaches the box surface
10
+
11
+ The 1.4.1 torture reorganization -- one runner (`bench/torture/run.mjs`), the
12
+ `semantic` / `soak` split, the shared `helpers/`, and the five semantic
13
+ scenarios -- is the floor this release builds on. 1.5.0 adds a sixth semantic
14
+ scenario, `box-torture`, targeting the new `signalBox` / `computedBox` surface.
15
+
16
+ The boxes are documented as the same `ReactiveNode` and the same zero-GC
17
+ read/write path as the callable forms, with full interop in one graph. That is
18
+ precisely the kind of claim that rots silently: a divergence between the two
19
+ representations produces correct-looking behaviour in any test that exercises
20
+ only one of them. So `box-torture` does not lead with box-specific unit
21
+ assertions. Its centrepiece is the same differential fuzz `oracle-fuzzer` runs --
22
+ a random DAG checked against an independent uncached reference evaluator -- with
23
+ **every node independently realised as either a callable or a box**. The
24
+ reference does not know which is which. If the two representations ever disagree
25
+ on a value, on equality, or on dynamic dependency tracking, a mixed graph is
26
+ where it surfaces and a single-representation suite never would. The remainder
27
+ pins the surface the callables do not have (`subscribe` immediate-fire /
28
+ untracked-callback / idempotent-disposer, `update`) and the allocation-light
29
+ representation itself (zero own enumerable data beyond the two internal handle
30
+ slots, a stable shared prototype, never `setPrototypeOf`) -- the last being a
31
+ design law, not an implementation detail.
32
+
33
+ Mutation-verified, and the mixed-graph dimension is not decorative:
34
+
35
+ | mutant | caught by | missed by |
36
+ | ------ | --------- | --------- |
37
+ | `boxGet` skips dependency tracking | box-torture (299/300 seeds) + unit `24-signalbox` | -- |
38
+ | `computedBox` default equality `Object.is` -> `===` | **box-torture only** (33/300 seeds) | unit `24-signalbox` (12/12 pass), callable-only `oracle-fuzzer` (400/400 pass) |
39
+
40
+ The second row is the reason the scenario exists. A `computedBox` that silently
41
+ downgrades its default equality is invisible to the box unit suite and to the
42
+ callable fuzzer; only a graph that mixes both representations and fuzzes the
43
+ `-0` / `NaN` value boundary at a box-computed node position catches it.
44
+
45
+ `24-signalbox` moves from `{skip:true}` (its state on the 1.4.x line, where the
46
+ API did not exist) to fully live. The unit count rises to **453 passing** (1
47
+ skip, the architectural SSR N/A in `17-reactivity`), up from 405 on 1.4.1.
48
+
49
+ ### Changed -- torture sources are ASCII (again)
50
+
51
+ `bench/torture/box-torture.mjs` shipped with em dashes and box-drawing
52
+ characters, and `helpers/index.mjs` had regained them. `Signal.js` is pure ASCII
53
+ and the ecosystem source rule permits only the sanctioned multiplication and
54
+ micro signs, so both were normalised (`--`, `<=`, `-`). The published surface is
55
+ unaffected either way -- `files[]` excludes `bench/`.
8
56
 
9
57
  ### Changed -- benchmark harness rewritten (bench protocol v3, breaking)
10
58
 
@@ -347,43 +395,69 @@ tolerances (`frame.avg` 5% rolling / 10% floor, `frame.p99` and `phase.write.p99
347
395
  18% / 30%), four workloads mapping to public bench claims -- carries forward
348
396
  from 1.4.0. Details in `harness/VersionMatrix/README.md`.
349
397
 
350
- ### Verified -- fresh 1.5.0-beta bench sweep
351
-
352
- Both benches were re-run in full on the 1.5.0-beta engine and their outputs
353
- committed to `bench/results.txt` (isolated propagation, 9 scenarios) and
354
- `bench/resultsReactive.txt` (cross-framework reactivity, median-of-10, 34
355
- tests). The 10 raw reactive-suite runs sit under `bench/bench-runs-reactive/
356
- run_1.txt` ... `run_10.txt` so anyone can re-median independently.
357
-
358
- - **Propagation bench (results.txt):** lite +48% / +45% / +33% / +29% on the four
359
- allocation-heavy scenarios (SELECTIVE DAG / DYNAMIC DAG / MUX / SMALL
360
- SELECTIVE); **LARGE WEB APP flipped into a small lite win (+2%, from -3% on
361
- 1.4.0)** after the alien-signals 3.1.2 -> 3.2.1 bump between sweeps; parity on
362
- WIDE DENSE (-6%) and KAIROS (-7%); alien ahead on BROADCAST (-12%) and DEEP
363
- CHAIN (-14%, narrowed from -29% on 1.4.0 for the same alien-version reason
364
- -- lite's DEEP CHAIN barely moved, 395 -> 398ms). Speed wins vs alien: **5/9**
365
- (was 4/9); heap wins: 8/9.
366
- - **Reactive suite (resultsReactive.txt):** fastest of five frameworks on all
367
- five `dyn` rows (simple +19%, dynamic +16%, large web app +9%, wide dense +6%,
368
- deep +12%), and **lite now leads alien on ALL 7 `S: updateComputations` rows**
369
- this sweep (+3% / +6% / +3% / +12% / +3% / +2% / +8%; was 4/7 on 1.4.0).
370
- - **Andrii Volynets js-reactivity-benchmark position holds at 4th of 15** with
371
- geomean **79.3ms** (raw log `bench/AndriiVolynetsReactiveBench.log`); lite is
372
- ahead of 5th-place Preact Signals (99.8) by ~21% -- the gap widened this
373
- sweep after Preact's own regression on the newer 1.14.2. Top-3 count moved
374
- from 21/47 (1.3.0 log) -> 23/47 (1.4.0 log) -> **25/47 (1.5.0-beta log)**;
375
- outright-fastest-of-15 wins fluctuate at the top of a very tight leaderboard
376
- where alien-signals / reflex / lite trade sub-percent margins per shape (5
377
- outright wins on 1.4.0, **2 outright wins on 1.5.0-beta** -- `createComputations4to1`
378
- and `1000x5 - 25 sources (wide dense)`). The stable metric across every
379
- published sweep is the geomean rank at #4 of 15.
380
- - **Third-party version bumps** used in this sweep vs 1.4.0: alien-signals
381
- 3.1.2 -> 3.2.1, @preact/signals-core 1.14.1 -> 1.14.2, @vue/reactivity
382
- 3.5.13 -> 3.5.35, solid-js 1.9.12 -> 1.9.13. Any within-lib delta between
383
- the two sweeps reflects those bumps + host noise, not lite-signal changes:
384
- 1.4.0 -> 1.5.0 hot-path bytes are byte-identical (1.5.0 adds only the
385
- non-callable box handle shape, which affects construction cost and handle
386
- ergonomics but not the pooled-node read/write path).
398
+ ### Verified -- fresh 1.5.0-beta bench sweep (Apple M4 Pro / Node 26)
399
+
400
+ Both v3 instruments were re-run in full on the 1.5.0-beta engine on **Apple
401
+ M4 Pro darwin/arm64, Node 26.3.1** (a step up from the 1.4.0 sweep's 2016
402
+ Intel MacBook / Node 22 host), with `#STAMP`-verified outputs committed to
403
+ `bench/rb.txt` (microscope aggregate, 4 engines across the six first-party
404
+ shapes) and `bench/r.txt` (mirror sweep, Andrii's canonical adapter verbatim,
405
+ lite vs alien across 47 rows, isolated-per-row, 10 reps). The M4 Pro host has
406
+ a lower run-to-run noise floor than the old Intel host, so the sub-percent
407
+ parity band tightens and the honest wins/losses stand out cleanly.
408
+
409
+ - **Microscope aggregate (rb.txt):** on the six v3 microscope shapes, lite
410
+ wins vs alien on **MUX +34.6%** (fan-in), **SELECTIVE DAG +20.0%**, and
411
+ **DYNAMIC DAG +18.4%** -- the allocation-heavy dynamic shapes stay lite's
412
+ home turf; the wins narrow versus the older Intel sweep (fast machine has
413
+ less GC pause to hide behind, so alien's raw propagation surfaces more) but
414
+ the ordering is intact. **BROADCAST is a true tie** (-1.2%, both under the
415
+ GC delta floor). Alien ahead on **KAIROS -15.7%** (1000 shared-source
416
+ computeds -- alien's flatter representation prices in the walk cheaper on
417
+ M4-class silicon) and **DEEP CHAIN -76.9%** (256-deep chain -- the same
418
+ architectural weak spot the honest framing has always named; recursive
419
+ JS-stack computed resolution loses to alien's flatter chain on hot new
420
+ cores by a wider margin than on old Intel). Speed wins vs alien: **3/6**;
421
+ heap wins: **5/6** with the sixth being a shared-zero on BROADCAST.
422
+ - **Microscope heap (the actual story):** on every shape where GC pressure
423
+ exists at all, lite allocates **one to four orders of magnitude less
424
+ transient heap than alien** -- DEEP CHAIN 0.5 KB vs 1062 KB (>2000x, on
425
+ the shape lite loses on time), MUX 0 KB vs 781 KB, KAIROS 23 KB vs 802 KB
426
+ (34.8x), DYNAMIC DAG 3.1 MB vs 60.7 MB (19.5x), SELECTIVE DAG 7.7 MB vs
427
+ 78.0 MB (10.2x). Against preact-signals and solid-signals the heap gap is
428
+ even wider on the fan-in / fan-out family; solid allocates ~17 MB on MUX
429
+ and ~15 MB on SELECTIVE DAG where lite allocates 0 KB and 7.7 MB on the
430
+ same shapes. The differentiated position is ALLOCATION, not raw
431
+ propagation speed -- competitive-to-winning throughput with dramatically
432
+ lower GC pressure, and that is the headline that reproduces across hosts.
433
+ - **Mirror sweep (r.txt):** Andrii's canonical 47-shape suite re-run
434
+ isolated-per-row lite vs alien on M4 Pro reproduces the same honest
435
+ framing: lite runs **parity-to-behind alien on throughput** across the
436
+ suite (wins outright on 4/47 -- `1000x5 - 25 sources (wide dense)` +12%,
437
+ `manySourcesIntoOneComputedEffectWithDirect` +32.5%,
438
+ `manySourcesIntoOneComputedEffect` +31.7%, and `createComputations4to1`
439
+ +19.3%), weak on the deep/layered-burst family. Every row carries a
440
+ `#STAMP` and the counters (`nodesRecomputed` / `edgesTraversed` /
441
+ `sinkReads`) match Andrii's published suite exactly (`mirror.mjs
442
+ --self-verify`), so a lite-vs-alien delta here is identical work, not DCE.
443
+ - **Andrii Volynets js-reactivity-benchmark position holds at 4th of 15**
444
+ with geomean **79.3ms** (raw log `bench/AndriiVolynetsReactiveBench.log`,
445
+ Andrii's own host); lite is ahead of 5th-place Preact Signals (99.8) by
446
+ ~21%. Top-3 count: **25/47** (up from 23 on 1.4.0);
447
+ outright-fastest-of-15 wins fluctuate at the top of a very tight
448
+ leaderboard where alien-signals / reflex / lite trade sub-percent margins
449
+ per shape (5 on 1.4.0, **2 on 1.5.0-beta** -- `createComputations4to1`
450
+ and `1000x5 - 25 sources (wide dense)`), plus 9 second-place finishes.
451
+ The stable metric across every published sweep is the geomean rank at #4
452
+ of 15.
453
+ - **Third-party version bumps** used in the local head-to-head vs 1.4.0:
454
+ alien-signals 3.1.2 -> 3.2.1, @preact/signals-core 1.14.1 -> 1.14.2,
455
+ @vue/reactivity 3.5.13 -> 3.5.35, solid-js 1.9.12 -> 1.9.13. Any
456
+ within-lib delta between the two sweeps reflects those bumps + the
457
+ Intel -> M4 Pro host change, not lite-signal changes: 1.4.0 -> 1.5.0
458
+ hot-path bytes are byte-identical (1.5.0 adds only the non-callable box
459
+ handle shape, which affects construction cost and handle ergonomics but
460
+ not the pooled-node read/write path).
387
461
 
388
462
  ## [1.4.0] -- 2026-06-XX
389
463
 
package/README.md CHANGED
@@ -723,27 +723,24 @@ These are the questions you'd ask in a code review, with the answers:
723
723
 
724
724
  ## Benchmarks
725
725
 
726
- 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.5.0-beta 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's hot paths are byte-identical to 1.4.0 (1.4.0 added three `stats()` counters on existing acquire/dispose/pool-grow edges; 1.5.0 adds the `signalBox` / `computedBox` non-callable handle shape -- cheaper CONSTRUCTION, same pooled-node read/write path -- and `createRoot`, an ownership escape hatch not on the hot path), so steady-state throughput tracks the 1.4.0 measurement within run-to-run noise on this old host. The third-party engine versions used in this sweep bumped from the 1.4.0 sweep (alien-signals 3.1.2 -> 3.2.1, @preact/signals-core 1.14.1 -> 1.14.2, @vue/reactivity 3.5.13 -> 3.5.35, solid-js 1.9.12 -> 1.9.13), so any within-lib delta between the two sweeps reflects those bumps + host noise, not lite-signal changes. 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.
726
+ 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.5.0-beta 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's hot paths are byte-identical to 1.4.0 (1.4.0 added three `stats()` counters on existing acquire/dispose/pool-grow edges; 1.5.0 adds the `signalBox` / `computedBox` non-callable handle shape -- cheaper CONSTRUCTION, same pooled-node read/write path -- and `createRoot`, an ownership escape hatch not on the hot path), so steady-state throughput reflects the same engine bytes the 1.4.0 sweep measured; the deltas below are the M4 Pro / Node 26 machine speaking, plus the third-party version bumps since the 1.4.0 sweep (alien-signals 3.1.2 -> 3.2.1, @preact/signals-core 1.14.1 -> 1.14.2, @vue/reactivity 3.5.13 -> 3.5.35, solid-js 1.9.12 -> 1.9.13). Full outputs: [`bench/rb.txt`](bench/rb.txt) (this microscope aggregate across four engines) and [`bench/r.txt`](bench/r.txt) (the mirror sweep -- Andrii's canonical adapter verbatim, 47 rows, lite vs alien on the same M4 Pro host).
727
727
 
728
728
  | Scenario | What it stresses | lite-signal | alien-signals | lite vs alien | transient heap (lite / alien) |
729
729
  | ---------- | -------------------------------- | ----------- | ------------- | ------------- | ----------------------------- |
730
- | **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **4757 ms** | 9166 ms | **+48% faster** | **1.7 MB / 31 MB** (18x less) |
731
- | **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **9630 ms** | 17375 ms | **+45% faster** | **4.3 MB / 26 MB** (6.0x less) |
732
- | **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **67 ms** | 101 ms | **+33% faster** | **38 KB / 3.9 MB** (104x less) |
733
- | **SMALL SELECTIVE** | 6 layers × 64 wide, 6 cand / 3 read | **1940 ms** | 2745 ms | **+29% faster** | **0.3 KB / 25.9 MB** (>=25872x less) |
734
- | **LARGE WEB APP** | 12 layers × ~80 wide, conditional reads | **2800 ms** | 2845 ms | **+2% faster** | **0.3 KB / 41 KB** (41x less) |
735
- | **WIDE DENSE** | 5 layers × ~200 wide, dense fan-in | 2870 ms | 2719 ms | -6% (parity) | **0.3 KB / 11.6 MB** (>=11605x less) |
736
- | **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 1418 ms | 1327 ms | -7% (parity) | 178 KB / 1.0 MB (5.9x less) |
737
- | **BROADCAST** | 1 signal -> 1000 effects (fan-out) | 1210 ms | 1084 ms | -12% | 72 KB / 21 KB |
738
- | **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 398 ms | **349 ms** | -14% | 18 KB / 1.8 MB (96x less) |
730
+ | **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **22.52 ms** | 34.46 ms | **+34.6% faster** | **0 KB / 781 KB** (100% less) |
731
+ | **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **1994 ms** | 2493 ms | **+20.0% faster** | **7.7 MB / 78.0 MB** (90.2% less, 10.2x) |
732
+ | **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **3601 ms** | 4415 ms | **+18.4% faster** | **3.1 MB / 60.7 MB** (94.9% less, 19.5x) |
733
+ | **BROADCAST** | 1 signal -> 1000 effects (fan-out) | 458.04 ms | 452.78 ms | -1.2% (parity) | ~0 KB / ~0 KB (both fit under GC floor) |
734
+ | **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 517.75 ms | 447.64 ms | -15.7% | **23 KB / 802 KB** (97.1% less, 34.8x) |
735
+ | **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 170.89 ms | **96.59 ms** | -76.9% | **0.5 KB / 1062 KB** (100% less, >2000x) |
739
736
 
740
737
  *(lower time = faster; transient heap = average delta-heap per rep, lower = less GC pressure)*
741
738
 
742
- **Reading the table:** lite-signal's time wins cluster exactly where its zero-GC design pays off -- the **allocation-heavy dynamic shapes** (**SELECTIVE DAG +48%**, **DYNAMIC DAG +45%**, **SMALL SELECTIVE +29%**), where alien-signals churns the nursery and lite's object pool allocates near-nothing, plus **MUX +33%** (fan-in aggregation). These are the patterns that dominate live UI workloads under input churn: dashboards, scoreboards, HUDs, leaderboards. **LARGE WEB APP** flipped in lite's favor this sweep (+2%, from -3% on 1.4.0 -- alien 3.2.1 slightly slower on this shape than 3.1.2 was); on a ~2800ms base the sign of that parity result depends on the third-party version being measured against. On the cheap, low-allocation **stable** shapes (KAIROS, WIDE DENSE) lite runs at **parity** with alien -- within a 6-7% band inside this old host's run-to-run noise. The two losses are **BROADCAST (-12%)** (pure fan-out, no retracking for the pool to amortize) and **DEEP CHAIN (-14%)**: on a 256-deep computed pipeline alien's flatter representation still wins, though the gap narrowed considerably from -29% on the 1.4.0 sweep because alien-signals 3.2.1 got slower on the 256-deep shape than 3.1.2 was; lite's DEEP CHAIN barely moved between sweeps (395 -> 398ms).
739
+ **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 +34.6%** (fan-in aggregation), **SELECTIVE DAG +20.0%**, and **DYNAMIC DAG +18.4%** -- the wins narrow versus the older Intel sweep (the fast machine has less GC pause to hide behind, so alien's raw propagation shows up more) but the ordering is intact, and these are the patterns that dominate live UI workloads under input churn: dashboards, scoreboards, HUDs, leaderboards. **BROADCAST is a true tie** on this host (-1.2%, both engines fit under the GC delta floor). The two losses tell a consistent story: **KAIROS -15.7%** (1000 computeds sharing a single source -- alien's flatter representation prices in the walk cheaper than lite's pooled-link graph on M4-class silicon) and **DEEP CHAIN -76.9%** (a 256-deep computed pipeline, the same 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). The mirror-sweep companion ([`bench/r.txt`](bench/r.txt)) reproduces the same 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)` +12%, both `manySourcesIntoOne*ComputedEffect` fan-ins ~+32%, and `createComputations4to1` +19%) -- and this is not the story to tell.
743
740
 
744
- 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.7-4.3 MB (genuine retracking re-links) where alien-signals allocates 26-31 MB on the same shapes, and that allocation gap is the mechanism behind lite's +45-48% wins there once each engine is measured in isolation. On DEEP CHAIN, alien's transient heap moved from ~903 KB (with alien 3.1.2) to ~1.8 MB (with alien 3.2.1), further widening the heap gap to ~96x -- lite's 18 KB on the same shape is unchanged. The one scenario where lite allocates more is **BROADCAST** (72 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.
741
+ **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.8x), DYNAMIC DAG 3.1 MB vs 60.7 MB (19.5x), SELECTIVE DAG 7.7 MB vs 78.0 MB (10.2x). 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.7 MB respectively (`bench/rb.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.
745
742
 
746
- > 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.
743
+ > 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.
747
744
 
748
745
  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:
749
746
 
@@ -762,7 +759,7 @@ npm run bench
762
759
 
763
760
  ## Testing strategy
764
761
 
765
- Three tiers, all reproducible.
762
+ Four tiers, all reproducible.
766
763
 
767
764
  ### Tier 1 -- Behavior (unit tests, fast)
768
765
 
@@ -817,18 +814,75 @@ npm run test:gc
817
814
 
818
815
  ### Tier 3 -- Performance (comparative benchmark)
819
816
 
820
- `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 is retained one release as `bench-reactive-legacy` (**deprecated -- removed after 1.5.1**). Full methodology: [`bench/README.md`](./bench/README.md).
817
+ `npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes; the aggregate output is [`bench/rb.txt`](bench/rb.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/r.txt`](bench/r.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 is retained one release as `bench-reactive-legacy` (**deprecated -- removed after 1.5.1**). Full methodology: [`bench/README.md`](./bench/README.md).
821
818
 
822
819
  ```bash
823
820
  npm run bench
824
821
  ```
825
822
 
826
- ### Tier 4 -- Torture soaks (crash detection under chaos)
823
+ ### Tier 4 -- Torture (correctness and resources under chaos)
827
824
 
828
- `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:
825
+ `bench/torture/` holds nine scenarios in two groups, behind one runner. They are
826
+ not perf benchmarks: the ops/sec figures reflect random workload composition, not
827
+ engine throughput -- `bench/benchmark.mjs` remains the canonical perf harness.
829
828
 
830
- - zero thrown exceptions during the run, and
831
- - after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn).
829
+ ```bash
830
+ npm run torture # everything
831
+ npm run torture:semantic # correctness only, ~10s, CI-shaped
832
+ npm run torture:soak # resource soaks only
833
+ ```
834
+
835
+ ```bash
836
+ node bench/torture/run.mjs --list
837
+ node bench/torture/run.mjs --seconds 30 --bail
838
+ node bench/torture/run.mjs oracle box # substring match on names
839
+ ```
840
+
841
+ The runner spawns each scenario as a **child process** rather than importing it.
842
+ Several assert on global pool accounting and on the default registry, so running
843
+ two in one process would let the first one's residue poison the second's
844
+ baseline. `--expose-gc` is passed unconditionally -- some scenarios force
845
+ collection to settle finalizers, and without it they would silently degrade to
846
+ asserting nothing.
847
+
848
+ #### `semantic` -- deterministic, fast, asserts on **meaning**
849
+
850
+ Run these on every commit. They pin values, wakeups, work and ordering.
851
+
852
+ | scenario | pins |
853
+ | -------- | ---- |
854
+ | `oracle-fuzzer` | every computed against an independent uncached reference evaluator, over 400 seeds x 120 ops |
855
+ | `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
856
+ | `work-accounting` | minimum body-execution counts across 10 fixed topologies -- no missing recompute, no surplus one |
857
+ | `concurrent-storm` | eight reentrancy and flush-ordering contracts: self-write, `CycleError` on mutual loops, nested-batch boundaries, cascade ordering, cleanup writes, dispose-mid-flush, self-disposal, async interleaving |
858
+ | `scheduler-storm` | deferred execution under 10,000 effects: the gen-bound thunk's ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler not taking the pass down |
859
+ | `box-torture` (1.5.0) | `signalBox` / `computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box, plus the box-only surface (`subscribe`, `update`) and the allocation-light representation contract |
860
+
861
+ Why this group exists: the resource soaks below pass green on an engine whose
862
+ computeds return stale values. Flipping the clean short-circuit in `pullComputed`
863
+ from `<= 0` to `<= 1` keeps the pool perfectly balanced and throws nothing --
864
+ `oracle-fuzzer` catches it on 400/400 seeds, and all three soaks report PASS.
865
+ Separately, removing the `node.gen === gen` guard from the cached scheduler thunk
866
+ is caught by `scheduler-storm` and **missed by all 453 unit tests**. And a
867
+ `computedBox` that silently downgrades its default equality from `Object.is` to
868
+ `===` is caught by `box-torture` alone -- the box unit suite and the
869
+ callable-only oracle both pass it, because only a graph mixing both
870
+ representations exercises the divergence.
871
+
872
+ Where no contract is documented, these files pin the *observed* behaviour and say
873
+ so at the scenario, rather than asserting an invented one.
874
+
875
+ #### `soak` -- wall-clock bound, asserts on **resources**
876
+
877
+ Run these nightly or pre-publish. Large randomised graphs (1,500 / 7,500 / 3,300
878
+ nodes) under mixed fuzz -- leaf writes, batched writes, computed and effect
879
+ rewires, nested-batch and untrack reads, microtask-scheduled async flushes. Each
880
+ exits non-zero unless:
881
+
882
+ - zero exceptions were thrown during the run,
883
+ - after teardown `activeNodes` is at or below its leaf-only floor and
884
+ `activeLinks` is exactly `0`, and
885
+ - the JIT sink advanced -- proving the accumulator loops were not optimised away.
832
886
 
833
887
  ```bash
834
888
  node --expose-gc bench/torture/graph-fuzzer.mjs # 10s random-DAG fuzz, 1500 nodes
@@ -836,13 +890,19 @@ node --expose-gc bench/torture/torture-soak.mjs # 5s high-volume churn, 750
836
890
  node --expose-gc bench/torture/scheduler-bench.mjs # 10s microtask-scheduled, 3300 nodes
837
891
  ```
838
892
 
839
- Run any of them with `TORTURE_SECONDS=N` for a longer soak. Indicative numbers from a development host (post-teardown pool returns to baseline in all three):
893
+ Any of them takes `TORTURE_SECONDS=N` for a longer soak (the runner's `--seconds`
894
+ sets it for all three). Indicative numbers from a development host:
895
+
896
+ | | duration | ops | errors | post-teardown nodes / links | floor |
897
+ | --------------------- | --------:| --------:| ------:| --------------------------- | -------- |
898
+ | graph-fuzzer | 10 s | 7.6 M | 0 | 500 / 0 | <= 508 |
899
+ | torture-soak | 5 s | 1.2 M | 0 | 2500 / 0 | <= 2508 |
900
+ | scheduler-bench | 10 s | 28.8 M | 0 | 1000 / 0 | <= 1008 |
840
901
 
841
- | | duration | ops | errors | post-teardown nodes / links |
842
- | --------------------- | --------:| --------:| ------:| --------------------------- |
843
- | graph-fuzzer | 10 s | 7.6 M | 0 | 500 / 0 |
844
- | torture-soak | 5 s | 1.2 M | 0 | 2500 / 0 |
845
- | scheduler-bench | 10 s | 28.8 M | 0 | 1000 / 0 |
902
+ The floor is the assertion; the pre-soak figure is not. Teardown disposes the
903
+ computeds and effects and leaves the signals alive, so post-teardown is *supposed*
904
+ to sit far below the pre-soak node count. Each soak prints the floor it asserted
905
+ against so the verdict can be checked against the numbers.
846
906
 
847
907
  ```bash
848
908
  npm run verify # test + test:gc + a sanity bench
@@ -971,30 +1031,34 @@ In stable environments (game engines, particle systems, visualizers), `lite-sign
971
1031
  | **1000x5 (25 sources, wide/dense)** | 304ms | 303ms | 1746ms |
972
1032
  | **64x6 (selective dynamic DAG)** | 181ms | 196ms | 559ms |
973
1033
 
974
- *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
+ *1.5.0-beta (default eager) on the v3 microscope (`bench/rb.txt`, Apple M4 Pro darwin/arm64, Node 26.3.1, one engine per cold process -- compare within-column, lite vs alien):*
975
1035
  | Scenario | alien-signals | lite-signal (1.5.0-beta) | result |
976
1036
  | :--- | :--- | :--- | :--- |
977
- | **SELECTIVE DAG** (sqrt-layered, set churn) | 9166ms | 4757ms | **lite +48%** |
978
- | **DYNAMIC DAG** (sqrt-layered, FAN=6) | 17375ms | 9630ms | **lite +45%** |
979
- | **SMALL SELECTIVE** (~ 64x6) | 2745ms | 1940ms | **lite +29%** |
980
- | **LARGE WEB APP** (~ 1000x12) | 2845ms | 2800ms | **lite +2%** (flipped from -3% on 1.4.0) |
981
- | **WIDE DENSE** (~ 1000x5) | 2719ms | 2870ms | alien +6% |
982
-
983
- > **Honest note (1.5.0-beta isolated run):** measured one-engine-per-process, lite-signal's
984
- > big wins are still on the **allocation-heavy** dynamic shapes (SELECTIVE DAG +48%, DYNAMIC
985
- > DAG +45%, SMALL SELECTIVE +29%) -- exactly where alien churns the nursery and lite's pool
986
- > allocates near-nothing. **LARGE WEB APP flipped into a small lite win this sweep** (+2%,
987
- > from -3% on 1.4.0), attributable to the alien-signals 3.1.2 -> 3.2.1 bump between sweeps;
988
- > on a ~2800ms base the sign of that parity result depends on which third-party version is
989
- > in the other column. 1.5.0's hot paths are byte-identical to 1.4.0 (1.5.0 adds the
990
- > `signalBox` / `computedBox` non-callable handle plus `createRoot`, none of which move
991
- > steady-state throughput), so these match the 1.4.0 isolated numbers within noise -- not
992
- > engine changes. lite remains the only zero-alloc library on every stable scenario
993
- > (see [`results.txt`](bench/results.txt)).
994
-
995
- The cross-framework reactivity suite agrees independently, re-run on **1.5.0-beta** (default eager, median-of-10, isolated): lite-signal is the **fastest of five frameworks on all five `dyn` rows** -- `dyn: large web app` **539ms** (+9% vs alien-signals' 593ms) and `dyn: wide dense` **874ms** (+6% vs 932ms), plus simple component (+19%), dynamic component (+16%), and deep (+12%) -- with preact 6-19x slower and vue 15-32x 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/)). **Lite now leads alien on all 7 `S: updateComputations` micro-rows** as well this sweep (was 4/7 on 1.4.0) -- +3% / +6% / +3% / +12% / +3% / +2% / +8% across the family, with the exact per-row numbers in `resultsReactive.txt`. 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).
996
-
997
- **The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.5.0-beta holds the line -- the engine still ranks **4th of 15** on the official js-reactivity-benchmark (the only zero-GC library in the field). `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. LARGE WEB APP flipped into a small lite win this sweep after the alien-signals 3.2.1 bump; it runs at parity with alien on the other cheap stable shapes. The one shape where alien's flatter representation still leads is the 256-deep computed pipeline (DEEP CHAIN, -14% on the 1.5.0-beta isolated run -- the gap narrowed from -29% on 1.4.0, again because alien 3.2.1 got slower on that specific shape, not because lite improved).
1037
+ | **MUX** (256 sigs -> sum -> effect) | 34.46 ms | 22.52 ms | **lite +34.6%** |
1038
+ | **SELECTIVE DAG** (sqrt-layered, set churn) | 2493 ms | 1994 ms | **lite +20.0%** |
1039
+ | **DYNAMIC DAG** (sqrt-layered, FAN=6) | 4415 ms | 3601 ms | **lite +18.4%** |
1040
+ | **BROADCAST** (1 -> 1000 effects) | 452.78 ms | 458.04 ms | tie (-1.2%, both under GC floor) |
1041
+ | **KAIROS** (1 -> 1000 computeds) | 447.64 ms | 517.75 ms | alien +15.7% |
1042
+ | **DEEP CHAIN** (256-deep -> effect) | 96.59 ms | 170.89 ms | alien +76.9% |
1043
+
1044
+ > **Honest note (1.5.0-beta on M4 Pro):** measured one-engine-per-process, lite-signal's
1045
+ > wins cluster on the **allocation-heavy** dynamic shapes (MUX +34.6%, SELECTIVE DAG
1046
+ > +20.0%, DYNAMIC DAG +18.4%) -- exactly where alien churns the nursery and lite's pool
1047
+ > allocates near-nothing. The wins narrow versus the older Intel MacBook sweep (fast
1048
+ > machine has less GC pause to hide behind, so alien's raw propagation surfaces more)
1049
+ > but the ordering is intact. BROADCAST is a true tie on this host. Alien ahead on
1050
+ > KAIROS -15.7% (1000 shared-source computeds -- alien's flatter representation prices
1051
+ > in the walk cheaper on M4-class silicon) and DEEP CHAIN -76.9% (the same architectural
1052
+ > weak spot the honest framing has always named). 1.5.0's hot paths are byte-identical
1053
+ > to 1.4.0 (1.5.0 adds the `signalBox` / `computedBox` non-callable handle plus
1054
+ > `createRoot`, none of which move steady-state throughput), so the deltas here are the
1055
+ > M4 Pro / Node 26 host speaking, plus the third-party version bumps -- not engine
1056
+ > changes. lite remains one to four orders of magnitude below alien on transient heap
1057
+ > on every shape where GC pressure exists at all (see [`bench/rb.txt`](bench/rb.txt)).
1058
+
1059
+ The mirror sweep ([`bench/r.txt`](bench/r.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)` +12%, both `manySourcesIntoOne*ComputedEffect` fan-ins ~+32%, and `createComputations4to1` +19%), 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).
1060
+
1061
+ **The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.5.0-beta holds the line -- the engine still ranks **4th of 15** on the official js-reactivity-benchmark (the only zero-GC library in the field). `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 M4 Pro sweep the win margins narrow on the dynamic shapes (SELECTIVE DAG +20%, DYNAMIC DAG +18%, MUX +34.6%) because the fast machine has less GC pause to hide behind; the ordering is intact and the heap column is the story that reproduces everywhere. The one shape where alien's flatter representation still leads decisively is the 256-deep computed pipeline (DEEP CHAIN -76.9% on the M4 Pro isolated run -- the gap widened from -14% on the older Intel sweep because recursive JS-stack computed resolution loses to alien's flatter chain on hot new cores by a wider margin than on old Intel; lite's allocation on DEEP CHAIN is 0.5 KB vs alien's 1062 KB, >2000x less transient heap on the same shape).
998
1062
 
999
1063
  ### Roadmap
1000
1064
  - **1.1.5** -- additions in service of `lite-devtools` (node identity/traversability on the introspection walkers, for full auto-discovered graph rendering). *Shipped.*
@@ -1252,7 +1316,10 @@ Yes, if your computeFn reads its deps in the same order each invocation. The `cu
1252
1316
  ```bash
1253
1317
  npm test # behavior suite, ~1.3s
1254
1318
  npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
1255
- npm run bench # comparative benchmark vs alien-signals (results.txt), ~5min
1319
+ npm run bench # microscope + mirror comparative benches (rb.txt / r.txt), ~5min
1320
+ npm run torture # full torture suite, all 9 scenarios (6 semantic + 3 soak)
1321
+ npm run torture:semantic # correctness scenarios only, ~10s
1322
+ npm run torture:soak # resource soaks only, wall-clock bound
1256
1323
  node --expose-gc bench/benchmarkReactive.mjs # DEPRECATED pre-v3 reactivity suite (removed after 1.5.1)
1257
1324
  npm run harness:field # verify + cold-child A/B bench (fieldkit)
1258
1325
  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.5.0
2
+ * @zakkster/lite-signal v1.5.0-beta.8
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
@@ -53,7 +53,22 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
53
53
 
54
54
  ## Version notes
55
55
 
56
- - **1.5.0-beta.2** (current): the re-attach companion to `createRoot`.
56
+ - **1.5.0-beta.8** (current): the **torture-surface bump**. No engine change --
57
+ the only edit to `Signal.js` is the version string in its banner. The torture
58
+ suite (one runner `bench/torture/run.mjs`, `semantic` / `soak` groups, shared
59
+ `helpers/`) gains a sixth semantic scenario, **`box-torture`**, for the
60
+ `signalBox` / `computedBox` surface. It runs the same differential fuzz as
61
+ `oracle-fuzzer` but realises every node in the random DAG as EITHER a callable
62
+ or a box, checked against an independent uncached reference that does not know
63
+ which is which -- the only test that exercises box<->callable divergence in a
64
+ mixed graph. Mutation-verified: a `computedBox` whose default equality silently
65
+ downgrades from `Object.is` to `===` is caught by `box-torture` alone (33/300
66
+ seeds); the box unit suite (`24-signalbox`, now fully live, 12/12) and the
67
+ callable-only `oracle-fuzzer` (400/400) both pass it. Unit total is now **453
68
+ pass, 1 skip** (the SSR N/A in `17-reactivity`), up from 405 on 1.4.1. Nothing
69
+ here ships: `files[]` excludes `bench/`. Drop-in over 1.5.0-beta.2.
70
+
71
+ - **1.5.0-beta.2**: the re-attach companion to `createRoot`.
57
72
  **`getOwner()`** and **`runWithOwner(ownerHandle, fn)`** land as registry
58
73
  methods + top-level bindings. **No engine change** from 1.5.0-beta.1 -- the
59
74
  hot-path function bodies (`pullComputed`, `markDownstream`, `executeEffect`,
@@ -578,51 +593,58 @@ None of these touch the reactive engine -- no `FLAG_WATCHER` on `ReactiveNode`,
578
593
 
579
594
  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.
580
595
 
581
- ## Benchmark snapshot (Node 22, 2016-era Intel MacBook Pro, default eager, median across reps -- @1.5.0-beta.0)
596
+ ## Benchmark snapshot (Node 26.3.1, Apple M4 Pro darwin/arm64, default eager, median across reps -- @1.5.0-beta.0)
582
597
 
583
- `benchmark.mjs` head-to-head vs alien-signals on app-shaped scenarios (time = median
584
- execution; heap = average transient delta-heap per rep; lite-signal numbers are
585
- @1.5.0-beta.0, hot paths byte-identical to 1.4.0 -- 1.5.0 adds only the
598
+ v3 microscope (`benchmark.mjs`, six first-party shapes) head-to-head vs alien-signals
599
+ (time = median execution; heap = average transient delta-heap per rep; lite-signal
600
+ numbers are @1.5.0-beta.0, hot paths byte-identical to 1.4.0 -- 1.5.0 adds only the
586
601
  `signalBox` / `computedBox` non-callable handle and `createRoot`, neither on the
587
602
  steady-state read/write path; third-party engines bumped since 1.4.0 sweep --
588
- alien-signals 3.1.2 -> 3.2.1 in particular):
603
+ alien-signals 3.1.2 -> 3.2.1 in particular; host changed from 2016 Intel MacBook /
604
+ Node 22 to Apple M4 Pro / Node 26, which lowers the run-to-run noise floor):
589
605
 
590
606
  | Scenario | lite vs alien (time) | transient heap (lite / alien) |
591
607
  | -------------------------------- | -------------------- | ----------------------------- |
592
- | SELECTIVE DAG (set churn) | **+48% faster** | 1.7 MB / 31 MB |
593
- | DYNAMIC DAG (FAN=6, read flips) | **+45% faster** | 4.3 MB / 26 MB |
594
- | MUX (256 sigs -> sum -> effect) | **+33% faster** | 38 KB / 3.9 MB |
595
- | SMALL SELECTIVE (~64x6) | **+29% faster** | 0.3 KB / 25.9 MB |
596
- | LARGE WEB APP (~1000x12) | **+2% faster** | 0.3 KB / 41 KB |
597
- | WIDE DENSE (~1000x5) | -6% (parity) | 0.3 KB / 11.6 MB |
598
- | KAIROS (1 -> 1000 computeds) | -7% (parity) | 178 KB / 1.0 MB |
599
- | BROADCAST (1 -> 1000 effects) | -12% | 72 KB / 21 KB |
600
- | DEEP CHAIN (256-deep -> effect) | -14% | 18 KB / 1.8 MB |
601
-
602
- lite-signal's time wins are the allocation-heavy dynamic shapes (object pool allocates
603
- near-nothing; alien churns the nursery), plus MUX fan-in aggregation -- the patterns
604
- that dominate live UI under input churn. LARGE WEB APP flipped into a small lite win
605
- this sweep (+2%, was -3% on 1.4.0) after the alien 3.1.2 -> 3.2.1 bump. Parity on
606
- WIDE DENSE / KAIROS (within run-to-run noise on this old host). Two losses: BROADCAST
607
- (pure fan-out, no retracking for the pool to amortize) and DEEP CHAIN (alien's flatter
608
- representation still wins on long chains, though the gap narrowed from -29% on 1.4.0
609
- to -14% here -- alien 3.2.1 got slower on 256-deep, lite's DEEP CHAIN barely moved).
610
- On allocation, lite wins 8/9 scenarios and is alone in the zero-alloc band (~0.3 KB
611
- transient on the stable app shapes).
612
-
613
- The cross-framework reactivity suite (5 frameworks) re-run on 1.5.0-beta (default eager,
614
- median-of-10): lite-signal is fastest on all five `dyn:*` rows -- `dyn: large web app`
615
- 539ms (+9% vs alien-signals' 593ms), `dyn: wide dense` 874ms (+6% vs 932ms), plus
616
- simple component (+19%), dynamic component (+16%), deep (+12%) -- with preact 6-19x
617
- slower and vue 15-32x slower on the app-shaped graphs. On the `S: updateComputations`
618
- micro-rows **lite now leads alien on ALL 7 rows this sweep** (+3% / +6% / +3% / +12% /
619
- +3% / +2% / +8%; was 4/7 on 1.4.0). Retracking verified correct by
620
- `retracking.difftest.mjs` (20,000 direct + 10,000 batched writes, 0 disagreements vs
621
- published 1.1.5). `prealloc: "lazy"` trades a little first-construction allocation on the
622
- dynamic shapes for a smaller resident heap and faster cold start; steady state identical.
608
+ | MUX (256 sigs -> sum -> effect) | **+34.6% faster** | 0 KB / 781 KB (100% less) |
609
+ | SELECTIVE DAG (set churn) | **+20.0% faster** | 7.7 MB / 78.0 MB (10.2x) |
610
+ | DYNAMIC DAG (FAN=6, read flips) | **+18.4% faster** | 3.1 MB / 60.7 MB (19.5x) |
611
+ | BROADCAST (1 -> 1000 effects) | -1.2% (parity) | ~0 KB / ~0 KB (both zero) |
612
+ | KAIROS (1 -> 1000 computeds) | -15.7% | 23 KB / 802 KB (34.8x) |
613
+ | DEEP CHAIN (256-deep -> effect) | -76.9% | 0.5 KB / 1062 KB (>2000x) |
614
+
615
+ lite-signal's time wins on the M4 Pro sweep cluster on the allocation-heavy dynamic
616
+ shapes (object pool allocates near-nothing; alien churns the nursery), plus MUX fan-in
617
+ aggregation -- the patterns that dominate live UI under input churn. The wins narrow
618
+ versus the older Intel sweep (fast machine has less GC pause to hide behind, so
619
+ alien's raw propagation surfaces more) but the ordering is intact. BROADCAST is a true
620
+ tie on this host (both under the GC delta floor). Two losses: KAIROS -15.7%
621
+ (1000 shared-source computeds -- alien's flatter representation prices in the walk
622
+ cheaper on M4-class silicon) and DEEP CHAIN -76.9% (the same architectural weak spot
623
+ the honest framing has always named; recursive JS-stack computed resolution loses to
624
+ alien's flatter chain on hot new cores by a wider margin than on old Intel). On
625
+ allocation, lite wins 5/6 shapes and is one to four orders of magnitude below alien on
626
+ every shape where GC pressure exists at all.
627
+
628
+ **The differentiated position is ALLOCATION, not raw propagation speed** -- competitive
629
+ throughput with dramatically lower GC pressure, not "fastest dynamic-graph engine".
630
+ That headline reproduces across hosts, sweeps, and third-party version bumps because
631
+ the object pool is the mechanism, not a tuning knob.
632
+
633
+ Mirror sweep (`bench/r.txt`, Andrii's canonical adapter verbatim, isolated-per-row,
634
+ 10 reps, lite vs alien only on the same M4 Pro host) reproduces the same picture
635
+ across all 47 shapes: lite runs parity-to-behind alien on throughput, wins outright
636
+ on 4/47 (`1000x5 - 25 sources (wide dense)` +12%,
637
+ `manySourcesIntoOneComputedEffectWithDirect` +32.5%, `manySourcesIntoOneComputedEffect`
638
+ +31.7%, and `createComputations4to1` +19.3%), weak on the deep/layered-burst family.
639
+ Every row carries a `#STAMP` and the counters (`nodesRecomputed` / `edgesTraversed` /
640
+ `sinkReads`) match Andrii's published suite exactly, so a lite-vs-alien delta here is
641
+ identical work, not DCE. Retracking verified correct by `retracking.difftest.mjs`
642
+ (20,000 direct + 10,000 batched writes, 0 disagreements vs published 1.1.5).
643
+ `prealloc: "lazy"` trades a little first-construction allocation on the dynamic shapes
644
+ for a smaller resident heap and faster cold start; steady state identical.
623
645
 
624
646
  Retained heap after forced GC: typically negative for all libs (V8 compacts).
625
- The one exception: lite-signal shows ~+71 KB retained on KAIROS, which is the
647
+ The one exception: lite-signal shows ~+23 KB retained on KAIROS, which is the
626
648
  pre-allocated pool holding the live 1002-node graph in steady state. This is
627
649
  the design: the pool IS the working memory. Not a leak.
628
650
 
@@ -716,7 +738,8 @@ function dumpOwnerTree(handle, depth = 0) {
716
738
  - `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
717
739
  - `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
718
740
  - `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
719
- - `bench/torture/` -- crash-detection soaks: `graph-fuzzer`, `scheduler-bench`, `torture-soak`. Exit 0 iff zero errors AND post-teardown pool clean.
741
+ - `bench/torture/` -- nine scenarios behind one runner (`run.mjs`), two groups. `semantic` (deterministic, fast, asserts on MEANING; CI on every commit): `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), `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, plus box-only subscribe/update and the allocation-light representation contract). `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`.
742
+ - `bench/torture/helpers/index.mjs` -- shared torture infrastructure: seeded `mulberry32` (failures replay from their seed), `soakRegistry` / `fixedRegistry`, `createReport` (collects failures rather than throwing on the first), and `VALUE_POOL`, the adversarial value domain carrying the pairs where candidate equality definitions disagree (`Object.is` vs `===` on NaN and -0/0; `===` vs `==` on 0/""/false/"0" and null/undefined). Dependency-free and side-effect-free by contract: importing it must not touch the default registry.
720
743
  - `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
721
744
  - `harness/run.mjs` -- dispatcher for the run-on-demand probes (field, dispose, churn, owner, creation, all).
722
745
  - `harness/fieldkit.mjs` -- single-file portable verify + cold-child A/B bench across six shapes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zakkster/lite-signal",
3
- "version": "1.5.0-beta.6",
3
+ "version": "1.5.0-beta.8",
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",
@@ -44,7 +44,10 @@
44
44
  "harness:creation": "node harness/run.mjs creation",
45
45
  "harness:all": "node harness/run.mjs all",
46
46
  "verify": "npm test && npm run bench",
47
- "gate": "node harness/VersionMatrix/pre-publish.mjs"
47
+ "gate": "node harness/VersionMatrix/pre-publish.mjs",
48
+ "torture": "node bench/torture/run.mjs",
49
+ "torture:semantic": "node bench/torture/run.mjs --group semantic",
50
+ "torture:soak": "node bench/torture/run.mjs --group soak"
48
51
  },
49
52
  "keywords": [
50
53
  "signal",
@@ -85,8 +88,8 @@
85
88
  "@zakkster/lite-profiler": "^1.1.0",
86
89
  "@zakkster/lite-profiler-signal": "^1.2.0",
87
90
  "@zakkster/lite-signal": "^1.3.0 || >=1.4.0-beta.0 || >=1.6.0-preview.0",
88
- "coveralls-next": "^6.0.2",
89
- "c8": "^11.0.0"
91
+ "c8": "^11.0.0",
92
+ "coveralls-next": "^6.0.2"
90
93
  },
91
94
  "overrides": {
92
95
  "@zakkster/lite-time": {