@zakkster/lite-signal 1.9.0-preview.1 → 1.9.0-preview.3
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 +127 -8
- package/LICENSE.txt +21 -0
- package/README.md +103 -52
- package/Signal.js +1 -1
- package/llms.txt +106 -42
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,51 @@ 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
|
-
## [
|
|
7
|
+
## [1.9.0-preview.2] -- 2026-07-27
|
|
8
|
+
|
|
9
|
+
Rolls up the post-`1.9.0-preview` changes into the `preview.2` tag. The 1.9.0
|
|
10
|
+
feature (`using` / `Symbol.dispose` on lifecycle objects) ships in the preview and
|
|
11
|
+
is unchanged here; this cut adds two new torture scenarios from a consolidated
|
|
12
|
+
coverage audit, the crash fix inherited from the 1.8.0 base, 100% coverage, and
|
|
13
|
+
test-suite hygiene.
|
|
14
|
+
|
|
15
|
+
### Added -- torture suite reaches the zero-skip milestone (19 scenarios)
|
|
16
|
+
|
|
17
|
+
Two effects converge on the 1.9.0 engine. First, **`dispose-torture` now
|
|
18
|
+
executes**: 1.9.0 stamps `Symbol.dispose` at five sites (the registry -> destroy,
|
|
19
|
+
an effect's stop handle, a `createScope` disposer, a `createRoot` disposer, and
|
|
20
|
+
both box prototypes), so `using`-declared lifecycle objects dispose at block exit.
|
|
21
|
+
The scenario feature-detects via the box-prototype stamp and drives each site
|
|
22
|
+
through the TC39 `using` path, asserting idempotent disposal. Because it is a set
|
|
23
|
+
of stamped methods with **no new export**, it is exactly the profile the value /
|
|
24
|
+
introspection oracles cannot see. Second, the coverage audit added **two new
|
|
25
|
+
semantic scenarios** for exports no scenario exercised directly:
|
|
26
|
+
|
|
27
|
+
- **`owner-torture`** (1.6.0+) -- `getOwner` / `runWithOwner` capture-restore: the
|
|
28
|
+
gen-stamped owner handle, adoption of effects/computeds created inside
|
|
29
|
+
`runWithOwner`, and cascade-dispose when the captured owner is torn down.
|
|
30
|
+
- **`lifecycle-torture`** (createRoot 1.5.0+, destroy 1.4.0+) -- `createRoot`
|
|
31
|
+
detachment (an owned subtree that survives its enclosing scope) and the direct
|
|
32
|
+
`destroy` reset contract; `createRoot` had never been called by any scenario,
|
|
33
|
+
and `destroy` was only reached indirectly through a registry `Symbol.dispose`.
|
|
34
|
+
|
|
35
|
+
The suite is now **19 scenarios (16 semantic + 3 soak)**. On the 1.9.0 engine
|
|
36
|
+
**every semantic scenario executes -- zero feature-skips** -- the first engine
|
|
37
|
+
version to run the complete superset, since `dispose` was the last remaining
|
|
38
|
+
feature gate (box 1.5.0, scope/owner/introspect 1.6.0, flush 1.7.0,
|
|
39
|
+
cleanup-return 1.8.0, dispose 1.9.0 are all satisfied).
|
|
40
|
+
|
|
41
|
+
### Verified -- full suite green on the 1.9.0 engine (Node 22, `--expose-gc`)
|
|
42
|
+
|
|
43
|
+
- **Torture:** 19/19 -- `torture:semantic` 16/16 (all executed, zero skips),
|
|
44
|
+
`torture:soak` 3/3 (zero errors, every pool back to its leaf-only floor).
|
|
45
|
+
- **Unit (plain run):** 499 tests, 479 pass, 0 fail, 1 skip (the architectural
|
|
46
|
+
SSR N/A in `17-reactivity`). The only non-passes are the 19 in
|
|
47
|
+
`test/25-devtools-real-boot`, the real-rig that requires the sibling
|
|
48
|
+
`@zakkster/lite-devtools`; with that sibling resolvable the suite is 498 pass +
|
|
49
|
+
1 skip. Engine-only, excluding `test/25`: 480 tests, 479 pass, 1 skip. (The c8
|
|
50
|
+
coverage run below reports a different count -- perf-smoke budgets skip under
|
|
51
|
+
instrumentation.)
|
|
8
52
|
|
|
9
53
|
### Changed -- bench protocol v3 (carried forward)
|
|
10
54
|
|
|
@@ -43,8 +87,11 @@ cleanup-return array-append arm (carried in via `33-cleanup-return`). Three prov
|
|
|
43
87
|
|
|
44
88
|
Test-suite hygiene: `33-computed-selfdirty-prev-owner.test.mjs` renamed to `34-`
|
|
45
89
|
(the `33-` slot belongs to `33-cleanup-return`, which carries forward from 1.8.0
|
|
46
|
-
because this line inherits effect cleanup-return)
|
|
47
|
-
|
|
90
|
+
because this line inherits effect cleanup-return) -- the rename had left a
|
|
91
|
+
byte-identical `33-` copy behind, so the scope suite's `28-`/`29-` pattern
|
|
92
|
+
repeated here; the stray `33-computed-selfdirty-prev-owner.test.mjs` is deleted,
|
|
93
|
+
leaving one `34-`. The duplicate `28-scope.test.mjs` was likewise dropped in
|
|
94
|
+
favour of `29-scope.test.mjs` (both were byte-identical).
|
|
48
95
|
|
|
49
96
|
**Hot-path parity note:** the fix touches `disposeNode` and `freeLink`; re-baseline
|
|
50
97
|
the VersionMatrix engine sha256 on the next publish.
|
|
@@ -364,6 +411,80 @@ twins (see the 1.12.0-preview trace-twin design).
|
|
|
364
411
|
between `createRoot` and `createScope`; sha256 confirms no
|
|
365
412
|
pre-existing function was disturbed by the insertion.
|
|
366
413
|
|
|
414
|
+
### Verified -- fresh 1.9.0-preview bench sweep (Apple M4 Pro / Node 26)
|
|
415
|
+
|
|
416
|
+
Both v3 instruments were re-run in full on the 1.9.0-preview engine on
|
|
417
|
+
**Apple M4 Pro darwin/arm64, Node 26.3.1**, with `#STAMP`-verified
|
|
418
|
+
outputs committed to `bench/r.txt` (microscope aggregate, 4 engines
|
|
419
|
+
across the six first-party shapes) and `bench/rb.txt` (mirror sweep,
|
|
420
|
+
Andrii's canonical adapter verbatim, lite vs alien across 47 rows,
|
|
421
|
+
isolated-per-row, 10 reps). Andrii 15-framework log at
|
|
422
|
+
`bench/AndriiVolynetsReactiveBench.log` (byte-identical to 1.8.0's --
|
|
423
|
+
the 1.9.0-preview engine is sha256-identical to 1.8.0 on all 14
|
|
424
|
+
propagation / flush-scaffold functions and differs only in `effect` and
|
|
425
|
+
`createScope` by one existence-guarded `[Symbol.dispose]` stamp line
|
|
426
|
+
each on the cold creation path, so the ranking numbers carry with zero
|
|
427
|
+
re-verification cost).
|
|
428
|
+
|
|
429
|
+
- **Andrii Volynets js-reactivity-benchmark position holds at 3rd of
|
|
430
|
+
15** (the position lite moved to on 1.8.0) with geomean **95.4 ms**;
|
|
431
|
+
lite is ahead of 4th-place @reactively (136.0, lite 1.43x faster) and
|
|
432
|
+
5th-place Preact Signals (148.8, ~56% ahead), behind only
|
|
433
|
+
alien-signals (77.5) and reflex (89.7). **20 outright wins** (the
|
|
434
|
+
eight canonical propagation shapes, all four wide fan-in / fan-out
|
|
435
|
+
shapes, `molBench`, and seven of the rectangular / layered DAG
|
|
436
|
+
shapes). Top-3 count: **29/47**. Since the engine is sha256-identical
|
|
437
|
+
to 1.8.0 across every propagation function, this is the same log
|
|
438
|
+
1.8.0 published; re-running Andrii's suite would produce host-noise
|
|
439
|
+
drift, not a code-driven delta.
|
|
440
|
+
- **Microscope aggregate on M4 Pro (r.txt):** on the six v3 microscope
|
|
441
|
+
shapes, lite wins vs alien on **MUX +34.9%** (fan-in), **SELECTIVE
|
|
442
|
+
DAG +20.9%**, **DYNAMIC DAG +16.1%**, and **BROADCAST +5.2%**
|
|
443
|
+
(narrowed from +9.4% on 1.8.0 but still on the win side of parity).
|
|
444
|
+
The wins hold within noise of the 1.8.0 M4 Pro sweep despite the two
|
|
445
|
+
`[Symbol.dispose]` stamp lines added at effect / createScope
|
|
446
|
+
creation, which is what "one existence guard per cold creation path,
|
|
447
|
+
nothing on the propagation hot path" looks like in the propagation
|
|
448
|
+
numbers. Alien ahead on **KAIROS -19.5%** (widened from -15.9% on
|
|
449
|
+
1.8.0 -- host-noise drift on the shape where lite is architecturally
|
|
450
|
+
weakest) and **DEEP CHAIN -72.8%** (the architectural weak spot:
|
|
451
|
+
recursive JS-stack computed resolution against alien's flatter
|
|
452
|
+
chain). Speed wins vs alien: **4/6**; heap wins: **5/6** with the
|
|
453
|
+
sixth being a shared-zero on BROADCAST.
|
|
454
|
+
- **Microscope heap (the actual story) on M4 Pro:** on every shape
|
|
455
|
+
where GC pressure exists at all, lite allocates **one to four orders
|
|
456
|
+
of magnitude less transient heap than alien** -- DEEP CHAIN 0.5 KB vs
|
|
457
|
+
1062 KB (>2000x, on the shape lite loses on time), MUX 0 KB vs 781
|
|
458
|
+
KB, KAIROS 23 KB vs 802 KB (34.3x), DYNAMIC DAG 3.4 MB vs 55.7 MB
|
|
459
|
+
(16.6x), SELECTIVE DAG 7.7 MB vs 76.5 MB (9.9x). Against
|
|
460
|
+
preact-signals and solid-signals the heap gap is even wider on the
|
|
461
|
+
fan-in / fan-out family; solid allocates ~17 MB on MUX and ~15 MB on
|
|
462
|
+
SELECTIVE DAG where lite allocates 0 KB and 7.7 MB on the same
|
|
463
|
+
shapes. The differentiated position is ALLOCATION, not raw
|
|
464
|
+
propagation speed -- competitive-to-winning throughput with
|
|
465
|
+
dramatically lower GC pressure, and that is the headline that
|
|
466
|
+
reproduces across hosts.
|
|
467
|
+
- **Mirror sweep on M4 Pro (rb.txt):** Andrii's canonical 47-shape
|
|
468
|
+
suite re-run isolated-per-row lite vs alien on M4 Pro reproduces the
|
|
469
|
+
same honest framing: lite runs **parity-to-behind alien on
|
|
470
|
+
throughput** across the head-to-head suite (wins outright on **3/47**
|
|
471
|
+
-- `1000x5 - 25 sources (wide dense)` +10.7%,
|
|
472
|
+
`manySourcesIntoOneComputedEffectWithDirect` +31.5%,
|
|
473
|
+
`manySourcesIntoOneComputedEffect` +30.2%; `molBench` dropped from a
|
|
474
|
+
razor-thin +0.3% win on 1.8.0 to -0.4% parity this sweep, taking the
|
|
475
|
+
outright-win count from 4/47 to 3/47), weak on the deep/layered-burst
|
|
476
|
+
family. That head-to-head result and the "3rd of 15 with 20 outright
|
|
477
|
+
wins" both live on the same Andrii log and are not contradictory: the
|
|
478
|
+
outright-of-15 rankings look at each shape across every framework in
|
|
479
|
+
the field, so shapes where alien beats lite by 20-30% but reflex
|
|
480
|
+
beats both and everyone else is slower can still count as a lite
|
|
481
|
+
outright win when measured that way.
|
|
482
|
+
- **Third-party engine versions carried forward** from the 1.8.0 sweep
|
|
483
|
+
(alien-signals 3.2.1, @preact/signals-core 1.14.2, @vue/reactivity
|
|
484
|
+
3.5.35, solid-js 1.9.13). No peer bumps this cycle; the deltas here
|
|
485
|
+
are the 1.9 engine's own footprint (the two `[Symbol.dispose]` stamp
|
|
486
|
+
lines) plus host noise.
|
|
487
|
+
|
|
367
488
|
### Migration
|
|
368
489
|
|
|
369
490
|
Zero work for every existing user. Symbol.dispose is additive; nothing
|
|
@@ -381,8 +502,6 @@ cascade forward from every prior 1.x line without semantic change.
|
|
|
381
502
|
|
|
382
503
|
## [1.8.0-preview] -- 2026-07-XX
|
|
383
504
|
|
|
384
|
-
## [1.8.0-preview] -- 2026-07-XX
|
|
385
|
-
|
|
386
505
|
The **effect cleanup return** minor -- Reflex-study pattern A. One additive
|
|
387
506
|
hot-path change: an effect body may now `return` a cleanup function, which
|
|
388
507
|
runs before the next re-run and on dispose, composing with imperative
|
|
@@ -681,9 +800,9 @@ monomorphic targets and inlines the body. In "eager" mode the inlined body is
|
|
|
681
800
|
byte-identical to the 1.6.0 inline check `if (batchDepth === 0) flushEffects()`
|
|
682
801
|
-- **zero behavioral or performance regression** for any existing user.
|
|
683
802
|
|
|
684
|
-
This is NOT ledger
|
|
803
|
+
This is NOT ledger S0b #6 (per-call closure-var load of a primitive). It is a
|
|
685
804
|
hoisted function reference resolved once at registry build time and is a NEW
|
|
686
|
-
mechanism by the v1 roadmap
|
|
805
|
+
mechanism by the v1 roadmap S0b line 100 definition.
|
|
687
806
|
|
|
688
807
|
The `getOwner` / `runWithOwner` port adds new user-API functions but touches no
|
|
689
808
|
hot path. sha256 over the extracted function bodies of `pullComputed`,
|
|
@@ -728,7 +847,7 @@ pristine 1.7.0-preview byte-for-byte; the two new functions are inserted between
|
|
|
728
847
|
|
|
729
848
|
Real wins, but smaller than the gap to Reflex on the same shapes. The residual
|
|
730
849
|
gap is structural (per-write `gen` check, batch-revert epoch tracking, global
|
|
731
|
-
version bumping) -- design decisions accepted by
|
|
850
|
+
version bumping) -- design decisions accepted by S0b and not in scope here.
|
|
732
851
|
Modern V8's `try/finally` elision varies; expect higher absolute speedups on
|
|
733
852
|
production V8 than on this sandbox.
|
|
734
853
|
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zahary Shinikchiev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@zakkster/lite-signal)
|
|
6
6
|
[](https://github.com/sponsors/PeshoVurtoleta)
|
|
7
7
|

|
|
8
|
-

|
|
9
9
|
[](https://bundlephobia.com/result?p=@zakkster/lite-signal)
|
|
10
10
|
[](https://www.npmjs.com/package/@zakkster/lite-signal)
|
|
11
11
|
[](https://www.npmjs.com/package/@zakkster/lite-signal)
|
|
@@ -15,23 +15,25 @@
|
|
|
15
15
|

|
|
16
16
|
[](./LICENSE)
|
|
17
17
|
|
|
18
|
-
##
|
|
18
|
+
## 3rd of 15 on the community reactivity benchmark -- and the only zero-GC engine in the field
|
|
19
19
|
|
|
20
|
-
On the independent [js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark) (Andrii Volynets' fork; 15 reactive libraries, 47 tests), `lite-signal` places **
|
|
20
|
+
On the independent [js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark) (Andrii Volynets' fork; 15 reactive libraries, 47 tests), `lite-signal` **1.9.0-preview** places **3rd overall by geomean (95.4 ms)** -- up from 4th on every sweep before 1.8.0, clearing 4th-place @reactively (136.0) by ~43% and 5th-place Preact Signals (148.8) by ~56%, behind only alien-signals (77.5) and reflex (89.7). The Andrii log is byte-identical to 1.8.0's: 1.9.0-preview's engine is sha256-identical over 14 propagation / flush-scaffold functions and differs only in `effect` and `createScope` by one existence-guarded `[Symbol.dispose]` stamp line each, so the ranking claim carries forward with zero re-verification cost.
|
|
21
21
|
|
|
22
22
|
It is the **only object-pooled, zero-GC engine in the entire field**, and it gets that result without giving up glitch-freedom or lazy evaluation. Against the mainstream reactivity libraries it leads decisively:
|
|
23
23
|
|
|
24
24
|
| vs | lite-signal is |
|
|
25
25
|
| ---------------------- | -------------- |
|
|
26
|
-
| **@
|
|
27
|
-
| **
|
|
28
|
-
| **
|
|
29
|
-
|
|
|
30
|
-
| **
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
| **@reactively** | **1.43x faster** |
|
|
27
|
+
| **Preact Signals** | **1.56x faster** (~56% ahead) |
|
|
28
|
+
| **@vue/reactivity** | **2.4x faster** |
|
|
29
|
+
| **Signia** | **3.2x faster** |
|
|
30
|
+
| **MobX** | **4.1x faster** |
|
|
31
|
+
| **@solidjs/signals** | **4.4x faster** |
|
|
32
|
+
| **SolidJS** | **7.7x faster** |
|
|
33
|
+
| reflex | 0.94x (~6% behind, 2nd place) |
|
|
34
|
+
| alien-signals | 0.81x (the field leader) |
|
|
35
|
+
|
|
36
|
+
`lite-signal` finishes **top-3 on 29 of the 47 tests** and is the **outright fastest of all 15** on **twenty shapes** -- the eight canonical propagation shapes (`avoidablePropagation`, `broadPropagation`, `deepPropagation`, `diamond`, `mux`, `repeatedObservers`, `triangle`, `unstable`), all four wide fan-in / fan-out shapes (`manyEffectsFromOneSource`, `manySourcesIntoOneComputedEffect`, `manySourcesIntoOneComputedEffectWithDirect`, `manySourcesIntoOneDirectEffect`), `molBench` (the mixed-app graph the suite uses as its realistic-workload proxy), and seven of the rectangular / layered DAG shapes (`64x6`, `24x8`, `120x7`, `40x10`, both `256->512x32 layered-dag` variants, and `10x10 dynamic component`). These are the aggregation and dynamic-DAG patterns that dominate live dashboards, scoreboards, and HUDs. The two engines ahead of it (alien-signals and reflex) are both push-eager designs that allocate on the hot path; `lite-signal` is the only top-3 finisher that allocates **nothing** in steady state. (Note: this suite measures reactivity *libraries* -- Vue's reactivity core, MobX, Solid, Preact Signals, etc. -- not full UI frameworks like React or Angular.)
|
|
35
37
|
|
|
36
38
|
```bash
|
|
37
39
|
npm install @zakkster/lite-signal
|
|
@@ -766,27 +768,29 @@ These are the questions you'd ask in a code review, with the answers:
|
|
|
766
768
|
|
|
767
769
|
## Benchmarks
|
|
768
770
|
|
|
769
|
-
Honest numbers, against the same workload, with anti-DCE sinks and verified effect execution. All measurements: Node
|
|
771
|
+
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.9.0-preview 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.8.0 -> 1.9.0-preview changes the engine at exactly two sites: `effect` and `createScope` each gain one existence-guarded `[Symbol.dispose]` stamp line on the cold creation path (`typeof Symbol.dispose === "symbol"` resolved once as `SYMBOL_DISPOSE` at module load, then one `!== null` guard per stamp site). sha256 over the 14 other propagation / flush-scaffold function bodies is byte-identical between pristine 1.8.0 and pristine 1.9.0-preview (`pullComputed`, `executeEffect`, `markDownstream`, `flushEffects`, `allocateLink`, `severTail`, `createNode`, `runCleanup`, `disposeNode`, `createRoot`, `flush`, `batch`, `signal`, `computed`). Full outputs: [`bench/r.txt`](./bench/r.txt) (this microscope aggregate across four engines) and [`bench/rb.txt`](./bench/rb.txt) (the mirror sweep -- Andrii's canonical adapter verbatim, 47 rows, lite vs alien on the same M4 Pro host).
|
|
770
772
|
|
|
771
773
|
| Scenario | What it stresses | lite-signal | alien-signals | lite vs alien | transient heap (lite / alien) |
|
|
772
774
|
| ---------- | -------------------------------- | ----------- | ------------- | ------------- | ----------------------------- |
|
|
773
|
-
| **
|
|
774
|
-
| **
|
|
775
|
-
| **
|
|
776
|
-
| **
|
|
777
|
-
| **KAIROS** | 1 signal -> 1000 computeds -> 1 effect |
|
|
778
|
-
| **
|
|
779
|
-
| **WIDE DENSE** | 5 layers × ~200 wide, dense fan-in | 2850 ms | 2740 ms | -4% (parity) | **0.3 KB / 11.6 MB** (>=11605x less) |
|
|
780
|
-
| **BROADCAST** | 1 signal -> 1000 effects (fan-out) | 1182 ms | 1074 ms | -10% | 72 KB / 21 KB |
|
|
781
|
-
| **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 401 ms | **339 ms** | -18% | 18 KB / 905 KB (49.7x less) |
|
|
775
|
+
| **MUX** | 256 signals -> 1 sum -> 1 effect (fan-in) | **22.98 ms** | 35.32 ms | **+34.9% faster** | **0 KB / 781 KB** (100% less) |
|
|
776
|
+
| **SELECTIVE DAG** | sqrt-layered, set churn, 2 read/iter | **2024 ms** | 2558 ms | **+20.9% faster** | **7.7 MB / 76.5 MB** (89.9% less, 9.9x) |
|
|
777
|
+
| **DYNAMIC DAG** | sqrt-layered, FAN=6, read flips each iter | **3737 ms** | 4453 ms | **+16.1% faster** | **3.4 MB / 55.7 MB** (94.0% less, 16.6x) |
|
|
778
|
+
| **BROADCAST** | 1 signal -> 1000 effects (fan-out) | **444.47 ms** | 468.88 ms | **+5.2% faster** | ~0 KB / ~0 KB (both fit under GC floor) |
|
|
779
|
+
| **KAIROS** | 1 signal -> 1000 computeds -> 1 effect | 525.27 ms | 439.61 ms | -19.5% | **23 KB / 802 KB** (97.1% less, 34.3x) |
|
|
780
|
+
| **DEEP CHAIN** | 256-deep computed chain -> 1 effect | 173.54 ms | **100.41 ms** | -72.8% | **0.5 KB / 1062 KB** (100% less, >2000x) |
|
|
782
781
|
|
|
783
782
|
*(lower time = faster; transient heap = average delta-heap per rep, lower = less GC pressure)*
|
|
784
783
|
|
|
785
|
-
**Reading the table:** lite-signal's time wins cluster exactly where its zero-GC design pays off -- the **allocation-heavy dynamic shapes** (**SELECTIVE DAG +
|
|
784
|
+
**Reading the table:** lite-signal's time wins cluster exactly where its zero-GC design pays off -- the **allocation-heavy dynamic shapes** (**SELECTIVE DAG +20.9%**, **DYNAMIC DAG +16.1%**), where alien-signals churns the nursery and lite's object pool allocates near-nothing, plus **MUX +34.9%** (fan-in aggregation) and **BROADCAST +5.2%** (fan-out; narrowed from +9.4% on 1.8.0 but still on the win side of parity). These are the patterns that dominate live UI workloads under input churn: dashboards, scoreboards, HUDs, leaderboards. That is **4 wins of 6** on time; on this sweep the wins hold within noise of the 1.8.0 M4 Pro sweep despite the two `[Symbol.dispose]` stamp lines added at effect / createScope creation, which is what "one existence guard per cold creation path, nothing on the propagation hot path" looks like in the propagation numbers. The two losses:
|
|
785
|
+
|
|
786
|
+
- **DEEP CHAIN (-72.8%)** 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 (100 ms vs 174 ms). It is not closed and it is not going to be closed by tuning. Note the inversion: **lite loses the row on time by 73% while allocating >2000x less heap**.
|
|
787
|
+
- **KAIROS (-19.5%)** widened from -15.9% on 1.8.0: 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. Consistent host-noise drift on the shape where lite is architecturally weakest.
|
|
788
|
+
|
|
789
|
+
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 55.7 MB (16.6x), SELECTIVE DAG 7.7 MB vs 76.5 MB (9.9x). 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/r.txt`). **`lite-signal`'s differentiated position is ALLOCATION, not raw propagation speed**: competitive-to-winning throughput with dramatically lower GC pressure, not "fastest dynamic-graph engine". That headline is the one that reproduces across hosts, sweeps, and third-party version bumps -- because the object pool is the mechanism, not a tuning knob.
|
|
786
790
|
|
|
787
|
-
|
|
791
|
+
The mirror-sweep companion ([`bench/rb.txt`](./bench/rb.txt)) reproduces the picture across Andrii's 47 shapes on the same M4 Pro host: lite runs **parity-to-behind alien on throughput** across the head-to-head suite, wins outright on **3 of the 47** (`1000x5 - 25 sources (wide dense)` +10.7%, `manySourcesIntoOneComputedEffectWithDirect` +31.5%, `manySourcesIntoOneComputedEffect` +30.2%; `molBench` dropped to -0.4% parity from the razor-thin +0.3% win on 1.8.0), weak on the deep/layered-burst family. That head-to-head result and the top-of-file "3rd of 15 with 20 outright wins" both live on the same Andrii log -- they are not contradictory: the outright-of-15 rankings look at each shape across every framework in the field, so shapes where alien beats lite by 20-30% but reflex beats both by another 10% and everyone else is slower can still count as a lite outright win when the leaderboard is measured that way.
|
|
788
792
|
|
|
789
|
-
> Note on the +
|
|
793
|
+
> 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.
|
|
790
794
|
|
|
791
795
|
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:
|
|
792
796
|
|
|
@@ -860,15 +864,59 @@ npm run test:gc
|
|
|
860
864
|
|
|
861
865
|
### Tier 3 -- Performance (comparative benchmark)
|
|
862
866
|
|
|
863
|
-
`npm run bench` runs the **microscope** -- lite's recommended eager config on six first-party shapes
|
|
867
|
+
`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).
|
|
864
868
|
|
|
865
869
|
```bash
|
|
866
870
|
npm run bench
|
|
867
871
|
```
|
|
868
872
|
|
|
869
|
-
### Tier 4 -- Torture
|
|
873
|
+
### Tier 4 -- Torture (correctness and resources under chaos)
|
|
874
|
+
|
|
875
|
+
`bench/torture/` holds the complete **19-scenario suite (16 semantic + 3 soak)**
|
|
876
|
+
behind one runner (`run.mjs`). They are not perf benchmarks: the ops/sec figures
|
|
877
|
+
reflect random workload composition, not engine throughput -- `bench/benchmark.mjs`
|
|
878
|
+
remains the canonical perf harness. Every scenario feature-detects and skips
|
|
879
|
+
cleanly below the engine version that introduces its feature; on the **1.9.0
|
|
880
|
+
engine all 16 semantic scenarios execute with zero feature-skips** -- the first
|
|
881
|
+
engine version to run the complete superset, since `dispose` was the last gate.
|
|
882
|
+
|
|
883
|
+
```bash
|
|
884
|
+
npm run torture # everything
|
|
885
|
+
npm run torture:semantic # correctness only, CI-shaped
|
|
886
|
+
npm run torture:soak # resource soaks only
|
|
887
|
+
node bench/torture/run.mjs --list
|
|
888
|
+
```
|
|
870
889
|
|
|
871
|
-
`
|
|
890
|
+
#### `semantic` -- deterministic, fast, asserts on **meaning**
|
|
891
|
+
|
|
892
|
+
Run these on every commit.
|
|
893
|
+
|
|
894
|
+
| scenario | pins |
|
|
895
|
+
| -------- | ---- |
|
|
896
|
+
| `oracle-fuzzer` | every computed against an independent uncached reference evaluator, 400 seeds x 120 ops |
|
|
897
|
+
| `glitch-hunter` | glitch freedom across diamonds, plus exact wakeup counts |
|
|
898
|
+
| `work-accounting` | minimum body-execution counts across 10 fixed topologies |
|
|
899
|
+
| `op-accounting` | structural work counted from the `onGraphMutation` opcode lane (op 1-5), not wall-clock |
|
|
900
|
+
| `introspect-torture` (1.6.0) | the read-only introspection surface: walk-agreement against the reference dep set + op-3/op-4 lane, and the ABA gen-stamp guard on re-walkable descriptors |
|
|
901
|
+
| `concurrent-storm` | eight reentrancy and flush-ordering contracts |
|
|
902
|
+
| `scheduler-storm` | deferred execution under 10,000 effects: gen-bound thunk ABA guard, `FLAG_QUEUED` coalescing, a throwing scheduler contained |
|
|
903
|
+
| `box-torture` (1.5.0) | `signalBox`/`computedBox` interop: the oracle differential fuzz with every node realised as **either** a callable or a box |
|
|
904
|
+
| `scope-torture` (1.6.0) | `createScope` adoption contract, the disposal-crash repro + a 300-seed fuzz, pool balance over 200 rounds |
|
|
905
|
+
| `owner-torture` (1.6.0) | `getOwner`/`runWithOwner` capture-restore: the gen-stamped owner handle, adoption of nodes created inside `runWithOwner`, cascade-dispose when the captured owner is torn down |
|
|
906
|
+
| `lifecycle-torture` | `createRoot` (1.5.0+) detachment of an owned subtree, and the direct `destroy` (1.4.0+) reset contract -- both previously unexercised by any scenario |
|
|
907
|
+
| `async-torture` | `watch`/`when`/`whenAsync` contracts + a 300-seed projection-guard storm |
|
|
908
|
+
| `capacity-torture` | the fail-closed pool boundary: exact ceilings, re-throw-on-read, `grow` crossing the same boundary |
|
|
909
|
+
| `flush-torture` (1.7.0) | the three `flushStrategy` modes by cross-strategy differential, per-strategy scheduling, re-entrant/empty `flush()`, and the `.subscribe()` contract under each |
|
|
910
|
+
| `cleanup-return-torture` (1.8.0) | an effect's returned cleanup: timing at re-run/dispose, compose order after `onCleanup`, the self-dispose guard, and the computed exclusion |
|
|
911
|
+
| `dispose-torture` (1.9.0) | `Symbol.dispose` stamped at five sites (registry, effect stop handle, scope/root disposers, both box prototypes) driven through the TC39 `using` path; idempotent disposal, feature-detected via the box-prototype stamp |
|
|
912
|
+
|
|
913
|
+
#### `soak` -- wall-clock bound, asserts on **resources**
|
|
914
|
+
|
|
915
|
+
Three soak harnesses build large randomised graphs (1,500 / 7,500 / 3,300 nodes)
|
|
916
|
+
and run mixed fuzz workloads -- leaf writes, batched writes, computed rewires,
|
|
917
|
+
effect rewires, nested-batch + untrack reads, and microtask-scheduled async
|
|
918
|
+
flushes -- for 5-10 seconds. What they assert, with a non-zero exit code on
|
|
919
|
+
failure:
|
|
872
920
|
|
|
873
921
|
- zero thrown exceptions during the run, and
|
|
874
922
|
- after teardown, `activeNodes` / `activeLinks` return to the leaf-only baseline (the dispose path is sound under sustained churn).
|
|
@@ -896,7 +944,7 @@ npm run verify # test + test:gc + a sanity bench
|
|
|
896
944
|
## Performance Trade-offs & Topology Scaling
|
|
897
945
|
|
|
898
946
|
<details>
|
|
899
|
-
<summary>Stable vs dynamic topologies; Andrii Volynets' matrix, the 1.1.4 result, the 1.
|
|
947
|
+
<summary>Stable vs dynamic topologies; Andrii Volynets' matrix, the 1.1.4 result, the 1.9.0-preview ranking, and the roadmap.</summary>
|
|
900
948
|
|
|
901
949
|
`lite-signal` was built with a strict mandate: **absolute zero garbage collection**. By packing the dependency graph into a flat, pre-allocated memory arena, we eliminate the Scavenger GC pauses that plague 120fps Canvas/WebGL loops.
|
|
902
950
|
|
|
@@ -904,10 +952,10 @@ Through **v1.1.2**, that came with a mathematical trade-off: while memory alloca
|
|
|
904
952
|
|
|
905
953
|
**Andrii Volynets** (author of the phenomenal [Alien Signals](https://github.com/stackblitz/alien-signals)) generously ran `lite-signal` through his advanced topology matrix on the **v1.1.2** engine. Those numbers -- the *pre-rewrite baseline* -- are below, followed by the 1.1.4 result.
|
|
906
954
|
|
|
907
|
-
**1.
|
|
955
|
+
**1.9.0-preview on the official [js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark) (15 libraries, 47 tests, raw log at [`bench/AndriiVolynetsReactiveBench.log`](./bench/AndriiVolynetsReactiveBench.log)):** `lite-signal` holds **3rd overall by geomean (95.4 ms)** -- the position it moved to on 1.8.0 -- behind only alien-signals (77.5, the field leader at 0.81x) and reflex (89.7, 0.94x), and **ahead of 4th-place @reactively (136.0, 1.43x) and 5th-place Preact Signals (148.8, ~56%)**. It finishes **top-3 on 29 of 47 tests** and is the **outright fastest of all 15 on twenty shapes** -- the eight canonical propagation shapes (`avoidablePropagation`, `broadPropagation`, `deepPropagation`, `diamond`, `mux`, `repeatedObservers`, `triangle`, `unstable`), all four wide fan-in / fan-out shapes (`manyEffectsFromOneSource`, `manySourcesIntoOneComputedEffect`, `manySourcesIntoOneComputedEffectWithDirect`, `manySourcesIntoOneDirectEffect`), `molBench`, and seven of the rectangular / layered DAG shapes. The Andrii log is byte-identical to 1.8.0's; 1.9.0-preview's engine differs from 1.8.0 only in `effect` and `createScope` by one existence-guarded `[Symbol.dispose]` stamp line each (cold creation path), so the ranking carries with zero re-verification cost. It remains the only object-pooled, zero-GC engine in the field.
|
|
908
956
|
|
|
909
957
|
#### 1. Stable Topologies (Fan-in / Fan-out / Broadcast)
|
|
910
|
-
In stable environments (game engines, particle systems, visualizers), `lite-signal` is blisteringly fast and maintains a near-zero allocation profile, keeping frame times perfectly flat -- unchanged through 1.1.4.
|
|
958
|
+
In stable environments (game engines, particle systems, visualizers), `lite-signal` is blisteringly fast and maintains a near-zero allocation profile, keeping frame times perfectly flat -- unchanged through 1.1.4 and holding on 1.9.0-preview.
|
|
911
959
|
|
|
912
960
|
#### 2. Dynamic Topologies (Web Apps / Layered DAGs) -- closed in 1.1.4
|
|
913
961
|
*Andrii's v1.1.2 baseline (his host) -- where the cursor retracking lost:*
|
|
@@ -917,27 +965,30 @@ In stable environments (game engines, particle systems, visualizers), `lite-sign
|
|
|
917
965
|
| **1000x5 (25 sources, wide/dense)** | 304ms | 303ms | 1746ms |
|
|
918
966
|
| **64x6 (selective dynamic DAG)** | 181ms | 196ms | 559ms |
|
|
919
967
|
|
|
920
|
-
*1.
|
|
921
|
-
| Scenario | alien-signals | lite-signal (1.
|
|
968
|
+
*1.9.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):*
|
|
969
|
+
| Scenario | alien-signals | lite-signal (1.9.0-preview) | result |
|
|
922
970
|
| :--- | :--- | :--- | :--- |
|
|
923
|
-
| **
|
|
924
|
-
| **
|
|
925
|
-
| **
|
|
926
|
-
| **
|
|
927
|
-
| **
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
>
|
|
931
|
-
>
|
|
932
|
-
>
|
|
933
|
-
>
|
|
934
|
-
>
|
|
935
|
-
>
|
|
936
|
-
>
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
971
|
+
| **MUX** (256 sigs -> sum -> effect) | 35.32 ms | 22.98 ms | **lite +34.9%** |
|
|
972
|
+
| **SELECTIVE DAG** (sqrt-layered, set churn) | 2558 ms | 2024 ms | **lite +20.9%** |
|
|
973
|
+
| **DYNAMIC DAG** (sqrt-layered, FAN=6) | 4453 ms | 3737 ms | **lite +16.1%** |
|
|
974
|
+
| **BROADCAST** (1 -> 1000 effects) | 468.88 ms | 444.47 ms | **lite +5.2%** (narrowed from +9.4% on 1.8.0) |
|
|
975
|
+
| **KAIROS** (1 -> 1000 computeds) | 439.61 ms | 525.27 ms | alien +19.5% (widened from -15.9% on 1.8.0) |
|
|
976
|
+
| **DEEP CHAIN** (256-deep pull) | 100.41 ms | 173.54 ms | **alien +72.8%** |
|
|
977
|
+
|
|
978
|
+
> **Honest note (1.9.0-preview isolated run):** measured one-engine-per-process, lite-signal's
|
|
979
|
+
> wins cluster on the **allocation-heavy** dynamic shapes and fan-in / fan-out (MUX +34.9%,
|
|
980
|
+
> SELECTIVE DAG +20.9%, DYNAMIC DAG +16.1%, BROADCAST +5.2%) -- exactly where alien churns
|
|
981
|
+
> the nursery and lite's pool allocates near-nothing. The wins hold within noise of the 1.8.0
|
|
982
|
+
> M4 Pro sweep despite the two `[Symbol.dispose]` stamp lines added at effect / createScope
|
|
983
|
+
> creation; every other propagation function is sha256-identical between the two engines.
|
|
984
|
+
> **BROADCAST narrowed** from +9.4% to +5.2%; **KAIROS widened** from -15.9% to -19.5% --
|
|
985
|
+
> host-noise drift on the shape where lite is architecturally weakest, not an engine change.
|
|
986
|
+
> lite remains one to four orders of magnitude below alien on transient heap on every shape
|
|
987
|
+
> where GC pressure exists at all (see [`bench/r.txt`](./bench/r.txt)).
|
|
988
|
+
|
|
989
|
+
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** across the head-to-head suite, wins outright on **3/47** (`1000x5 - 25 sources (wide dense)` +10.7%, `manySourcesIntoOneComputedEffectWithDirect` +31.5%, `manySourcesIntoOneComputedEffect` +30.2%; `molBench` dropped from a razor-thin +0.3% on 1.8.0 to -0.4% parity), 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.
|
|
990
|
+
|
|
991
|
+
**The Takeaway:** as of 1.1.4 you no longer have to choose, and 1.9.0-preview holds the line -- the engine ranks **3rd of 15** on the official js-reactivity-benchmark (the position it moved to on 1.8.0) 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 decisively on the high-churn dynamic and fan-in topologies that dominate live UI -- the shapes where zero allocation pays off most. BROADCAST narrowed on the M4 Pro sweep this cycle (+9.4% -> +5.2%) but stayed on the win side of parity; KAIROS widened (-15.9% -> -19.5%). The one shape where alien's flatter representation still leads decisively is the 256-deep computed pipeline (DEEP CHAIN, -72.8% on the M4 Pro isolated run) -- and that gap is structural, not a tuning bug.
|
|
941
992
|
|
|
942
993
|
### Roadmap
|
|
943
994
|
- **1.1.5** -- additions in service of `lite-devtools` (node identity/traversability on the introspection walkers, for full auto-discovered graph rendering). *Shipped.*
|
|
@@ -1269,7 +1320,7 @@ Wired as `npm run test:harness`.
|
|
|
1269
1320
|
npm test # behavior suite, ~1.3s
|
|
1270
1321
|
npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
|
|
1271
1322
|
npm run test:harness # profiler-tools hardening suite
|
|
1272
|
-
npm run bench #
|
|
1323
|
+
npm run bench # microscope + mirror comparative benches (r.txt / rb.txt), ~5min
|
|
1273
1324
|
node --expose-gc bench/mirror.mjs --self-verify # cross-framework mirror sweep (bench protocol v3)
|
|
1274
1325
|
npm run harness:smoke # flushStrategy semantics -- asserts
|
|
1275
1326
|
npm run harness:all # smoke + field + dispose + churn probes
|
package/Signal.js
CHANGED
package/llms.txt
CHANGED
|
@@ -53,7 +53,45 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
53
53
|
|
|
54
54
|
## Version notes
|
|
55
55
|
|
|
56
|
-
- **1.
|
|
56
|
+
- **1.9.0-preview.2** (current): the **explicit-resource-management minor**. A
|
|
57
|
+
single-feature engine cut: `Symbol.dispose` is stamped at five sites -- the
|
|
58
|
+
registry (-> `destroy`), an effect's stop handle (-> `stop`), a `createScope`
|
|
59
|
+
disposer, a `createRoot` disposer, and both box prototypes (-> `dispose`) -- so
|
|
60
|
+
every lifecycle object works with the TC39 `using` declaration and disposes at
|
|
61
|
+
block exit. No new export; existence-guarded, so manual `[Symbol.dispose]()`
|
|
62
|
+
works on Node 20+ and the `: null` arm covers older runtimes. `preview.2` also
|
|
63
|
+
carries the dangling-cursor crash fix inherited from the 1.8.0 base (one-line
|
|
64
|
+
`disposeNode` cursor repair) and closes `Signal.js` to **100%**. Torture reaches
|
|
65
|
+
the **zero-skip milestone**: `dispose-torture` now executes, and a coverage audit
|
|
66
|
+
added two semantic scenarios -- `owner-torture` (`getOwner`/`runWithOwner`
|
|
67
|
+
capture-restore) and `lifecycle-torture` (`createRoot` detachment + the direct
|
|
68
|
+
`destroy` reset, both previously unexercised) -- bringing the suite to **19
|
|
69
|
+
scenarios (16 semantic + 3 soak)**, all 16 semantic executing on this engine with
|
|
70
|
+
no feature-skips (the first engine to run the complete superset). Verified green:
|
|
71
|
+
torture 19/19; unit **499 tests, 479 pass, 0 fail, 1 skip** (SSR N/A) -- 498 pass
|
|
72
|
+
with the sibling `@zakkster/lite-devtools` the 19-test `test/25` rig needs.
|
|
73
|
+
Drop-in over 1.8.0.
|
|
74
|
+
|
|
75
|
+
- **1.8.0**: the **effect-cleanup-return minor**. An EFFECT body may `return` a
|
|
76
|
+
cleanup function (Solid/Vue/Reflex-compatible), run at the same points as
|
|
77
|
+
`onCleanup` -- before each re-run and once on dispose -- and APPENDED after any
|
|
78
|
+
`onCleanup` from the same body, so both compose in call order. Non-function
|
|
79
|
+
returns ignored; self-disposed body registers nothing; computeds excluded (a
|
|
80
|
+
returned function stays the VALUE). Cost is one `typeof` per effect run;
|
|
81
|
+
`executeEffect` is the only hot body whose sha256 changed 1.7.0 -> 1.8.0. Torture
|
|
82
|
+
added `cleanup-return-torture` (timing, compose order, self-dispose guard,
|
|
83
|
+
computed exclusion).
|
|
84
|
+
|
|
85
|
+
- **1.7.0**: the **flush-strategy minor**. `createRegistry({flushStrategy})` gives
|
|
86
|
+
per-registry control over *when* effects deliver (`"eager"` default | `"sab"` |
|
|
87
|
+
`"manual"`), plus an explicit `r.flush()`; the lever resolves once at init into
|
|
88
|
+
two closure-captured `const` booleans, so the `"eager"` body is byte-identical to
|
|
89
|
+
1.6.0. Also forward-ported `getOwner` / `runWithOwner` from 1.5.0-beta.2 and fixed
|
|
90
|
+
the propagation benchmark harness (every pre-1.7.0 number in `bench/results.txt`
|
|
91
|
+
is void). Torture added `flush-torture` (the three modes by cross-strategy
|
|
92
|
+
differential + `.subscribe()`).
|
|
93
|
+
|
|
94
|
+
- **1.6.0-preview**: the **observability-and-lifecycle minor**, shipping
|
|
57
95
|
on the `preview` dist-tag while it settles. Two additions, both on existing
|
|
58
96
|
hot-path-adjacent edges:
|
|
59
97
|
|
|
@@ -529,48 +567,74 @@ None of these touch the reactive engine -- no `FLAG_WATCHER` on `ReactiveNode`,
|
|
|
529
567
|
|
|
530
568
|
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.
|
|
531
569
|
|
|
532
|
-
## Benchmark snapshot (Node
|
|
533
|
-
|
|
534
|
-
`benchmark.mjs` head-to-head vs
|
|
535
|
-
execution; heap = average transient delta-heap per rep;
|
|
536
|
-
@1.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
|
542
|
-
|
|
|
543
|
-
|
|
|
544
|
-
|
|
|
545
|
-
|
|
|
546
|
-
|
|
|
547
|
-
|
|
|
548
|
-
| DEEP CHAIN (256-deep -> effect) |
|
|
549
|
-
|
|
550
|
-
lite-signal's time wins
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
`
|
|
569
|
-
|
|
570
|
-
|
|
570
|
+
## Benchmark snapshot (Node 26.3.1, Apple M4 Pro darwin/arm64, default eager, median across reps -- @1.9.0-preview)
|
|
571
|
+
|
|
572
|
+
v3 microscope (`benchmark.mjs`, six first-party shapes, `bench/r.txt`) head-to-head vs
|
|
573
|
+
alien-signals (time = median execution; heap = average transient delta-heap per rep;
|
|
574
|
+
lite-signal numbers are @1.9.0-preview, engine differs from 1.8.0 only in `effect`
|
|
575
|
+
and `createScope` by one existence-guarded `[Symbol.dispose]` stamp line each on the
|
|
576
|
+
cold creation path; sha256 over the 14 other propagation / flush-scaffold function
|
|
577
|
+
bodies matches pristine 1.8.0 byte-for-byte):
|
|
578
|
+
|
|
579
|
+
| Scenario | lite | alien | lite vs alien (time) | transient heap (lite / alien) |
|
|
580
|
+
| -------------------------------- | -------- | -------- | -------------------- | ----------------------------- |
|
|
581
|
+
| MUX (256 sigs -> sum -> effect) | 22.98 ms | 35.32 ms | **+34.9% faster** | 0 KB / 781 KB (100% less) |
|
|
582
|
+
| SELECTIVE DAG (set churn) | 2024 ms | 2558 ms | **+20.9% faster** | 7.7 MB / 76.5 MB (9.9x) |
|
|
583
|
+
| DYNAMIC DAG (FAN=6, read flips) | 3737 ms | 4453 ms | **+16.1% faster** | 3.4 MB / 55.7 MB (16.6x) |
|
|
584
|
+
| BROADCAST (1 -> 1000 effects) | 444.47 ms | 468.88 ms | **+5.2% faster** | ~0 KB / ~0 KB (both zero) |
|
|
585
|
+
| KAIROS (1 -> 1000 computeds) | 525.27 ms | 439.61 ms | -19.5% | 23 KB / 802 KB (34.3x) |
|
|
586
|
+
| DEEP CHAIN (256-deep -> effect) | 173.54 ms | 100.41 ms | **-72.8%** | 0.5 KB / 1062 KB (>2000x) |
|
|
587
|
+
|
|
588
|
+
lite-signal's time wins on the 1.9.0-preview M4 Pro sweep cluster on the
|
|
589
|
+
allocation-heavy dynamic shapes (object pool allocates near-nothing; alien churns the
|
|
590
|
+
nursery), plus MUX fan-in aggregation and BROADCAST -- the patterns that dominate live
|
|
591
|
+
UI under input churn. **Speed wins vs alien: 4/6** (MUX, SELECTIVE DAG, DYNAMIC DAG,
|
|
592
|
+
BROADCAST). The four wins hold within noise of the 1.8.0 M4 Pro sweep despite the two
|
|
593
|
+
`[Symbol.dispose]` stamp lines -- **BROADCAST narrowed** from +9.4% to +5.2% but
|
|
594
|
+
stayed on the win side of parity; **KAIROS widened** from -15.9% to -19.5%,
|
|
595
|
+
host-noise drift on the shape where lite is architecturally weakest. **DEEP CHAIN
|
|
596
|
+
-72.8%** is the same architectural weak spot the honest framing has always named. On
|
|
597
|
+
allocation, lite wins 5/6 shapes and is one to four orders of magnitude below alien
|
|
598
|
+
on every shape where GC pressure exists at all; the sixth is a shared-zero on
|
|
599
|
+
BROADCAST.
|
|
600
|
+
|
|
601
|
+
**The differentiated position is ALLOCATION, not raw propagation speed** -- competitive-
|
|
602
|
+
to-winning throughput with dramatically lower GC pressure, not "fastest dynamic-graph
|
|
603
|
+
engine". That headline reproduces across hosts, sweeps, and third-party version bumps
|
|
604
|
+
because the object pool is the mechanism, not a tuning knob.
|
|
605
|
+
|
|
606
|
+
Mirror sweep (`bench/rb.txt`, Andrii's canonical adapter verbatim, isolated-per-row,
|
|
607
|
+
10 reps, lite vs alien only on the same M4 Pro host) reproduces the same picture
|
|
608
|
+
across all 47 shapes: lite runs parity-to-behind alien on throughput, wins outright
|
|
609
|
+
on **3/47**: `1000x5 - 25 sources (wide dense)` +10.7%,
|
|
610
|
+
`manySourcesIntoOneComputedEffectWithDirect` +31.5%, `manySourcesIntoOneComputedEffect`
|
|
611
|
+
+30.2%. `molBench` dropped from a razor-thin +0.3% win on 1.8.0 to -0.4% parity this
|
|
612
|
+
sweep, taking the outright-win count from 4/47 to 3/47. Weak on the deep/layered-burst
|
|
613
|
+
family. Every row carries a `#STAMP` and the counters (`nodesRecomputed` /
|
|
614
|
+
`edgesTraversed` / `sinkReads`) match Andrii's published suite exactly, so a
|
|
615
|
+
lite-vs-alien delta here is identical work, not DCE. Retracking verified correct by
|
|
616
|
+
`retracking.difftest.mjs` (20,000 direct + 10,000 batched writes, 0 disagreements
|
|
617
|
+
vs published 1.1.5).
|
|
618
|
+
|
|
619
|
+
**Andrii Volynets js-reactivity-benchmark position: 3rd of 15** (up from 4th on every
|
|
620
|
+
sweep before 1.8.0) with geomean **95.4 ms** (raw log
|
|
621
|
+
`bench/AndriiVolynetsReactiveBench.log`; byte-identical to 1.8.0's log because the
|
|
622
|
+
1.9.0-preview engine is sha256-identical to 1.8.0 on all 14 propagation / flush
|
|
623
|
+
functions -- only `effect` and `createScope` gain one existence-guarded
|
|
624
|
+
`[Symbol.dispose]` stamp line each on the cold creation path). Behind alien-signals
|
|
625
|
+
(77.5), reflex (89.7). Ahead of @reactively (136.0, lite 1.43x faster), Preact Signals
|
|
626
|
+
(148.8, ~56%), uSignal (195.4), $mol_wire (206.5), @amadeus-it-group/tans (210.4),
|
|
627
|
+
@vue/reactivity (229.4, 2.4x), Oby (242.5), Signia (307.0, 3.2x), MobX (388.3, 4.1x),
|
|
628
|
+
@solidjs/signals (420.6, 4.4x), s-js (480.1), SolidJS (733.5, 7.7x). **20 outright
|
|
629
|
+
wins**: the eight canonical propagation shapes (avoidablePropagation, broadPropagation,
|
|
630
|
+
deepPropagation, diamond, mux, repeatedObservers, triangle, unstable), all four wide
|
|
631
|
+
fan-in / fan-out shapes (manyEffectsFromOneSource, manySourcesIntoOneComputedEffect,
|
|
632
|
+
manySourcesIntoOneComputedEffectWithDirect, manySourcesIntoOneDirectEffect), molBench,
|
|
633
|
+
and seven of the rectangular / layered DAG shapes. Top-3 count: 29/47. lite-signal is
|
|
634
|
+
the only object-pooled, zero-GC engine in the field.
|
|
571
635
|
|
|
572
636
|
Retained heap after forced GC: typically negative for all libs (V8 compacts).
|
|
573
|
-
The one exception: lite-signal shows ~+
|
|
637
|
+
The one exception: lite-signal shows ~+23 KB retained on KAIROS, which is the
|
|
574
638
|
pre-allocated pool holding the live 1002-node graph in steady state. This is
|
|
575
639
|
the design: the pool IS the working memory. Not a leak.
|
|
576
640
|
|
|
@@ -664,7 +728,7 @@ function dumpOwnerTree(handle, depth = 0) {
|
|
|
664
728
|
- `bench/benchmark.mjs` -- anti-DCE throughput harness (ops/s; results.txt).
|
|
665
729
|
- `bench/benchmarkReactive.mjs` -- cross-framework reactivity suite vs alien-signals, preact, vue-reactivity, solid (resultsReactive.txt).
|
|
666
730
|
- `bench/dispose-recycle.mjs` -- 1.2.2 targeted microbench: create/dispose/recreate cycle (the free-list invariant audit target).
|
|
667
|
-
- `bench/torture/` -- crash-
|
|
731
|
+
- `bench/torture/` -- the complete **19-scenario suite (16 semantic + 3 soak)** behind one runner (`run.mjs`), two groups. Every scenario feature-detects and SKIPS cleanly below the engine version that introduces its feature; on the **1.9.0 engine all 16 semantic execute with zero skips** -- the first engine to run the whole superset, since `dispose` was the last feature gate. `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), `op-accounting` (structural work from the `onGraphMutation` opcode lane), `introspect-torture` (1.6.0: read-only introspection surface -- walk-agreement + 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 via oracle differential fuzz), `scope-torture` (1.6.0: `createScope` adoption + disposal-crash fuzz), `owner-torture` (1.6.0: `getOwner`/`runWithOwner` capture-restore -- gen-stamped handle, adoption inside `runWithOwner`, cascade-dispose), `lifecycle-torture` (`createRoot` 1.5.0+ detachment + the direct `destroy` 1.4.0+ reset -- both previously unexercised by any scenario), `async-torture` (watch/when/whenAsync + 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 + `.subscribe()`), `cleanup-return-torture` (1.8.0: an effect's returned cleanup -- timing, compose order, self-dispose guard, computed exclusion), `dispose-torture` (1.9.0: `Symbol.dispose` stamped at five sites driven through the TC39 `using` path, idempotent disposal, feature-detected via the box-prototype stamp). `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 and passes `--expose-gc` unconditionally. Scripts: `npm run torture`, `torture:semantic`, `torture:soak`.
|
|
668
732
|
- `bench/run-all.sh` + `bench/aggregate.mjs` -- cold-process-per-engine protocol + per-scenario aggregation.
|
|
669
733
|
- `harness/run.mjs` -- dispatcher for the run-on-demand probes (smoke, field, dispose, churn, owner, creation, perf, burst, pull, toe, all).
|
|
670
734
|
- `harness/smoke.mjs` -- 1.7 flushStrategy semantics (eager/sab/manual) + `flush()`, and the 1.8 effect-cleanup-return contract (fires before re-run + on dispose, composes with onCleanup in call order, non-function returns ignored, computed-returning-a-function still yields the VALUE). 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.9.0-preview.
|
|
3
|
+
"version": "1.9.0-preview.3",
|
|
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",
|