@zakkster/lite-signal 1.9.0-preview.0 → 1.9.0-preview.2
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 +87 -0
- package/README.md +59 -51
- package/llms.txt +67 -41
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,19 @@ This project follows [Semantic Versioning](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
### Changed -- bench protocol v3 (carried forward)
|
|
10
|
+
|
|
11
|
+
The `bench/` harness is bench protocol v3: three instruments (microscope / mirror /
|
|
12
|
+
version-economics), each with a fixed config and a machine-generated `#STAMP`
|
|
13
|
+
(engine + harness sha256, live registry config, host, node). The pre-v3
|
|
14
|
+
five-framework reactivity suite was removed after 1.5.1. See `bench/README.md`.
|
|
15
|
+
|
|
16
|
+
### Added -- Coveralls coverage badge
|
|
17
|
+
|
|
18
|
+
README carries a Coveralls badge; lcov is produced by `npm run test:report`
|
|
19
|
+
(`coveralls-next` in devDependencies).
|
|
20
|
+
|
|
21
|
+
|
|
9
22
|
### Fixed -- dangling re-tracking cursor on source disposal (crash)
|
|
10
23
|
|
|
11
24
|
Disposing a signal/computed from inside an observer that had linked it on the
|
|
@@ -351,6 +364,80 @@ twins (see the 1.12.0-preview trace-twin design).
|
|
|
351
364
|
between `createRoot` and `createScope`; sha256 confirms no
|
|
352
365
|
pre-existing function was disturbed by the insertion.
|
|
353
366
|
|
|
367
|
+
### Verified -- fresh 1.9.0-preview bench sweep (Apple M4 Pro / Node 26)
|
|
368
|
+
|
|
369
|
+
Both v3 instruments were re-run in full on the 1.9.0-preview engine on
|
|
370
|
+
**Apple M4 Pro darwin/arm64, Node 26.3.1**, with `#STAMP`-verified
|
|
371
|
+
outputs committed to `bench/r.txt` (microscope aggregate, 4 engines
|
|
372
|
+
across the six first-party shapes) and `bench/rb.txt` (mirror sweep,
|
|
373
|
+
Andrii's canonical adapter verbatim, lite vs alien across 47 rows,
|
|
374
|
+
isolated-per-row, 10 reps). Andrii 15-framework log at
|
|
375
|
+
`bench/AndriiVolynetsReactiveBench.log` (byte-identical to 1.8.0's --
|
|
376
|
+
the 1.9.0-preview engine is sha256-identical to 1.8.0 on all 14
|
|
377
|
+
propagation / flush-scaffold functions and differs only in `effect` and
|
|
378
|
+
`createScope` by one existence-guarded `[Symbol.dispose]` stamp line
|
|
379
|
+
each on the cold creation path, so the ranking numbers carry with zero
|
|
380
|
+
re-verification cost).
|
|
381
|
+
|
|
382
|
+
- **Andrii Volynets js-reactivity-benchmark position holds at 3rd of
|
|
383
|
+
15** (the position lite moved to on 1.8.0) with geomean **95.4 ms**;
|
|
384
|
+
lite is ahead of 4th-place @reactively (136.0, lite 1.43x faster) and
|
|
385
|
+
5th-place Preact Signals (148.8, ~56% ahead), behind only
|
|
386
|
+
alien-signals (77.5) and reflex (89.7). **20 outright wins** (the
|
|
387
|
+
eight canonical propagation shapes, all four wide fan-in / fan-out
|
|
388
|
+
shapes, `molBench`, and seven of the rectangular / layered DAG
|
|
389
|
+
shapes). Top-3 count: **29/47**. Since the engine is sha256-identical
|
|
390
|
+
to 1.8.0 across every propagation function, this is the same log
|
|
391
|
+
1.8.0 published; re-running Andrii's suite would produce host-noise
|
|
392
|
+
drift, not a code-driven delta.
|
|
393
|
+
- **Microscope aggregate on M4 Pro (r.txt):** on the six v3 microscope
|
|
394
|
+
shapes, lite wins vs alien on **MUX +34.9%** (fan-in), **SELECTIVE
|
|
395
|
+
DAG +20.9%**, **DYNAMIC DAG +16.1%**, and **BROADCAST +5.2%**
|
|
396
|
+
(narrowed from +9.4% on 1.8.0 but still on the win side of parity).
|
|
397
|
+
The wins hold within noise of the 1.8.0 M4 Pro sweep despite the two
|
|
398
|
+
`[Symbol.dispose]` stamp lines added at effect / createScope
|
|
399
|
+
creation, which is what "one existence guard per cold creation path,
|
|
400
|
+
nothing on the propagation hot path" looks like in the propagation
|
|
401
|
+
numbers. Alien ahead on **KAIROS -19.5%** (widened from -15.9% on
|
|
402
|
+
1.8.0 -- host-noise drift on the shape where lite is architecturally
|
|
403
|
+
weakest) and **DEEP CHAIN -72.8%** (the architectural weak spot:
|
|
404
|
+
recursive JS-stack computed resolution against alien's flatter
|
|
405
|
+
chain). Speed wins vs alien: **4/6**; heap wins: **5/6** with the
|
|
406
|
+
sixth being a shared-zero on BROADCAST.
|
|
407
|
+
- **Microscope heap (the actual story) on M4 Pro:** on every shape
|
|
408
|
+
where GC pressure exists at all, lite allocates **one to four orders
|
|
409
|
+
of magnitude less transient heap than alien** -- DEEP CHAIN 0.5 KB vs
|
|
410
|
+
1062 KB (>2000x, on the shape lite loses on time), MUX 0 KB vs 781
|
|
411
|
+
KB, KAIROS 23 KB vs 802 KB (34.3x), DYNAMIC DAG 3.4 MB vs 55.7 MB
|
|
412
|
+
(16.6x), SELECTIVE DAG 7.7 MB vs 76.5 MB (9.9x). Against
|
|
413
|
+
preact-signals and solid-signals the heap gap is even wider on the
|
|
414
|
+
fan-in / fan-out family; solid allocates ~17 MB on MUX and ~15 MB on
|
|
415
|
+
SELECTIVE DAG where lite allocates 0 KB and 7.7 MB on the same
|
|
416
|
+
shapes. The differentiated position is ALLOCATION, not raw
|
|
417
|
+
propagation speed -- competitive-to-winning throughput with
|
|
418
|
+
dramatically lower GC pressure, and that is the headline that
|
|
419
|
+
reproduces across hosts.
|
|
420
|
+
- **Mirror sweep on M4 Pro (rb.txt):** Andrii's canonical 47-shape
|
|
421
|
+
suite re-run isolated-per-row lite vs alien on M4 Pro reproduces the
|
|
422
|
+
same honest framing: lite runs **parity-to-behind alien on
|
|
423
|
+
throughput** across the head-to-head suite (wins outright on **3/47**
|
|
424
|
+
-- `1000x5 - 25 sources (wide dense)` +10.7%,
|
|
425
|
+
`manySourcesIntoOneComputedEffectWithDirect` +31.5%,
|
|
426
|
+
`manySourcesIntoOneComputedEffect` +30.2%; `molBench` dropped from a
|
|
427
|
+
razor-thin +0.3% win on 1.8.0 to -0.4% parity this sweep, taking the
|
|
428
|
+
outright-win count from 4/47 to 3/47), weak on the deep/layered-burst
|
|
429
|
+
family. That head-to-head result and the "3rd of 15 with 20 outright
|
|
430
|
+
wins" both live on the same Andrii log and are not contradictory: the
|
|
431
|
+
outright-of-15 rankings look at each shape across every framework in
|
|
432
|
+
the field, so shapes where alien beats lite by 20-30% but reflex
|
|
433
|
+
beats both and everyone else is slower can still count as a lite
|
|
434
|
+
outright win when measured that way.
|
|
435
|
+
- **Third-party engine versions carried forward** from the 1.8.0 sweep
|
|
436
|
+
(alien-signals 3.2.1, @preact/signals-core 1.14.2, @vue/reactivity
|
|
437
|
+
3.5.35, solid-js 1.9.13). No peer bumps this cycle; the deltas here
|
|
438
|
+
are the 1.9 engine's own footprint (the two `[Symbol.dispose]` stamp
|
|
439
|
+
lines) plus host noise.
|
|
440
|
+
|
|
354
441
|
### Migration
|
|
355
442
|
|
|
356
443
|
Zero work for every existing user. Symbol.dispose is additive; nothing
|
package/README.md
CHANGED
|
@@ -5,32 +5,35 @@
|
|
|
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)
|
|
12
|
+
[](https://coveralls.io/github/PeshoVurtoleta/lite-signal?branch=main)
|
|
12
13
|

|
|
13
14
|

|
|
14
15
|

|
|
15
16
|
[](./LICENSE)
|
|
16
17
|
|
|
17
|
-
##
|
|
18
|
+
## 3rd of 15 on the community reactivity benchmark -- and the only zero-GC engine in the field
|
|
18
19
|
|
|
19
|
-
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.
|
|
20
21
|
|
|
21
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:
|
|
22
23
|
|
|
23
24
|
| vs | lite-signal is |
|
|
24
25
|
| ---------------------- | -------------- |
|
|
25
|
-
| **@
|
|
26
|
-
| **
|
|
27
|
-
| **
|
|
28
|
-
|
|
|
29
|
-
| **
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
33
|
-
|
|
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.)
|
|
34
37
|
|
|
35
38
|
```bash
|
|
36
39
|
npm install @zakkster/lite-signal
|
|
@@ -765,27 +768,29 @@ These are the questions you'd ask in a code review, with the answers:
|
|
|
765
768
|
|
|
766
769
|
## Benchmarks
|
|
767
770
|
|
|
768
|
-
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).
|
|
769
772
|
|
|
770
773
|
| Scenario | What it stresses | lite-signal | alien-signals | lite vs alien | transient heap (lite / alien) |
|
|
771
774
|
| ---------- | -------------------------------- | ----------- | ------------- | ------------- | ----------------------------- |
|
|
772
|
-
| **
|
|
773
|
-
| **
|
|
774
|
-
| **
|
|
775
|
-
| **
|
|
776
|
-
| **KAIROS** | 1 signal -> 1000 computeds -> 1 effect |
|
|
777
|
-
| **
|
|
778
|
-
| **WIDE DENSE** | 5 layers × ~200 wide, dense fan-in | 2850 ms | 2740 ms | -4% (parity) | **0.3 KB / 11.6 MB** (>=11605x less) |
|
|
779
|
-
| **BROADCAST** | 1 signal -> 1000 effects (fan-out) | 1182 ms | 1074 ms | -10% | 72 KB / 21 KB |
|
|
780
|
-
| **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) |
|
|
781
781
|
|
|
782
782
|
*(lower time = faster; transient heap = average delta-heap per rep, lower = less GC pressure)*
|
|
783
783
|
|
|
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 +
|
|
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.
|
|
785
790
|
|
|
786
|
-
|
|
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.
|
|
787
792
|
|
|
788
|
-
> 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.
|
|
789
794
|
|
|
790
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:
|
|
791
796
|
|
|
@@ -859,7 +864,7 @@ npm run test:gc
|
|
|
859
864
|
|
|
860
865
|
### Tier 3 -- Performance (comparative benchmark)
|
|
861
866
|
|
|
862
|
-
`npm run bench` runs the
|
|
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).
|
|
863
868
|
|
|
864
869
|
```bash
|
|
865
870
|
npm run bench
|
|
@@ -895,7 +900,7 @@ npm run verify # test + test:gc + a sanity bench
|
|
|
895
900
|
## Performance Trade-offs & Topology Scaling
|
|
896
901
|
|
|
897
902
|
<details>
|
|
898
|
-
<summary>Stable vs dynamic topologies; Andrii Volynets' matrix, the 1.1.4 result, the 1.
|
|
903
|
+
<summary>Stable vs dynamic topologies; Andrii Volynets' matrix, the 1.1.4 result, the 1.9.0-preview ranking, and the roadmap.</summary>
|
|
899
904
|
|
|
900
905
|
`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.
|
|
901
906
|
|
|
@@ -903,10 +908,10 @@ Through **v1.1.2**, that came with a mathematical trade-off: while memory alloca
|
|
|
903
908
|
|
|
904
909
|
**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.
|
|
905
910
|
|
|
906
|
-
**1.
|
|
911
|
+
**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.
|
|
907
912
|
|
|
908
913
|
#### 1. Stable Topologies (Fan-in / Fan-out / Broadcast)
|
|
909
|
-
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.
|
|
914
|
+
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.
|
|
910
915
|
|
|
911
916
|
#### 2. Dynamic Topologies (Web Apps / Layered DAGs) -- closed in 1.1.4
|
|
912
917
|
*Andrii's v1.1.2 baseline (his host) -- where the cursor retracking lost:*
|
|
@@ -916,27 +921,30 @@ In stable environments (game engines, particle systems, visualizers), `lite-sign
|
|
|
916
921
|
| **1000x5 (25 sources, wide/dense)** | 304ms | 303ms | 1746ms |
|
|
917
922
|
| **64x6 (selective dynamic DAG)** | 181ms | 196ms | 559ms |
|
|
918
923
|
|
|
919
|
-
*1.
|
|
920
|
-
| Scenario | alien-signals | lite-signal (1.
|
|
924
|
+
*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):*
|
|
925
|
+
| Scenario | alien-signals | lite-signal (1.9.0-preview) | result |
|
|
921
926
|
| :--- | :--- | :--- | :--- |
|
|
922
|
-
| **
|
|
923
|
-
| **
|
|
924
|
-
| **
|
|
925
|
-
| **
|
|
926
|
-
| **
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
>
|
|
930
|
-
>
|
|
931
|
-
>
|
|
932
|
-
>
|
|
933
|
-
>
|
|
934
|
-
>
|
|
935
|
-
>
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
927
|
+
| **MUX** (256 sigs -> sum -> effect) | 35.32 ms | 22.98 ms | **lite +34.9%** |
|
|
928
|
+
| **SELECTIVE DAG** (sqrt-layered, set churn) | 2558 ms | 2024 ms | **lite +20.9%** |
|
|
929
|
+
| **DYNAMIC DAG** (sqrt-layered, FAN=6) | 4453 ms | 3737 ms | **lite +16.1%** |
|
|
930
|
+
| **BROADCAST** (1 -> 1000 effects) | 468.88 ms | 444.47 ms | **lite +5.2%** (narrowed from +9.4% on 1.8.0) |
|
|
931
|
+
| **KAIROS** (1 -> 1000 computeds) | 439.61 ms | 525.27 ms | alien +19.5% (widened from -15.9% on 1.8.0) |
|
|
932
|
+
| **DEEP CHAIN** (256-deep pull) | 100.41 ms | 173.54 ms | **alien +72.8%** |
|
|
933
|
+
|
|
934
|
+
> **Honest note (1.9.0-preview isolated run):** measured one-engine-per-process, lite-signal's
|
|
935
|
+
> wins cluster on the **allocation-heavy** dynamic shapes and fan-in / fan-out (MUX +34.9%,
|
|
936
|
+
> SELECTIVE DAG +20.9%, DYNAMIC DAG +16.1%, BROADCAST +5.2%) -- exactly where alien churns
|
|
937
|
+
> the nursery and lite's pool allocates near-nothing. The wins hold within noise of the 1.8.0
|
|
938
|
+
> M4 Pro sweep despite the two `[Symbol.dispose]` stamp lines added at effect / createScope
|
|
939
|
+
> creation; every other propagation function is sha256-identical between the two engines.
|
|
940
|
+
> **BROADCAST narrowed** from +9.4% to +5.2%; **KAIROS widened** from -15.9% to -19.5% --
|
|
941
|
+
> host-noise drift on the shape where lite is architecturally weakest, not an engine change.
|
|
942
|
+
> lite remains one to four orders of magnitude below alien on transient heap on every shape
|
|
943
|
+
> where GC pressure exists at all (see [`bench/r.txt`](./bench/r.txt)).
|
|
944
|
+
|
|
945
|
+
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.
|
|
946
|
+
|
|
947
|
+
**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.
|
|
940
948
|
|
|
941
949
|
### Roadmap
|
|
942
950
|
- **1.1.5** -- additions in service of `lite-devtools` (node identity/traversability on the introspection walkers, for full auto-discovered graph rendering). *Shipped.*
|
|
@@ -1268,8 +1276,8 @@ Wired as `npm run test:harness`.
|
|
|
1268
1276
|
npm test # behavior suite, ~1.3s
|
|
1269
1277
|
npm run test:gc # zero-gc suite, requires --expose-gc, ~3s
|
|
1270
1278
|
npm run test:harness # profiler-tools hardening suite
|
|
1271
|
-
npm run bench #
|
|
1272
|
-
|
|
1279
|
+
npm run bench # microscope + mirror comparative benches (r.txt / rb.txt), ~5min
|
|
1280
|
+
node --expose-gc bench/mirror.mjs --self-verify # cross-framework mirror sweep (bench protocol v3)
|
|
1273
1281
|
npm run harness:smoke # flushStrategy semantics -- asserts
|
|
1274
1282
|
npm run harness:all # smoke + field + dispose + churn probes
|
|
1275
1283
|
npm run gate # cold-process version-matrix regression gate (also runs on prepublish)
|
package/llms.txt
CHANGED
|
@@ -239,7 +239,7 @@ triggering write -- no `queueMicrotask`, no promises, no scheduler ticks.
|
|
|
239
239
|
Version lineage:
|
|
240
240
|
this is the engine previously labeled `1.2.3` in dev -- renumbered to
|
|
241
241
|
`1.2.2` because the deletion is small, isolated, and intentionally
|
|
242
|
-
non-behavioral. Drop-in over 1.2.1. **Bench position** (third-party
|
|
242
|
+
non-behavioral. Drop-in over 1.2.1. **Bench harness (protocol v3):** rebuilt around three fixed-config instruments -- microscope (`benchmark.mjs`, recommended eager config, six first-party shapes), mirror (`mirror.mjs` + `sweep.mjs`, Andrii's canonical adapter verbatim, rows diff 1:1 against his log), version-economics (`harness/toe-to-toe`) -- each output carrying a machine-generated `#STAMP` (engine + harness sha256, live registry config, host, node). Pre-v3 five-framework suite removed after 1.5.1. Methodology in `bench/README.md`. **Bench position** (third-party
|
|
243
243
|
[js-reactivity-benchmark](https://github.com/volynetstyle/js-reactivity-benchmark),
|
|
244
244
|
15 frameworks, 47 tests): #4 by geomean (75.5) at 1.77x behind alien-signals
|
|
245
245
|
(1.00x), reflex (1.15x), @reactively (1.39x); now ahead of 5th-place Preact
|
|
@@ -529,48 +529,74 @@ None of these touch the reactive engine -- no `FLAG_WATCHER` on `ReactiveNode`,
|
|
|
529
529
|
|
|
530
530
|
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
531
|
|
|
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
|
-
|
|
532
|
+
## Benchmark snapshot (Node 26.3.1, Apple M4 Pro darwin/arm64, default eager, median across reps -- @1.9.0-preview)
|
|
533
|
+
|
|
534
|
+
v3 microscope (`benchmark.mjs`, six first-party shapes, `bench/r.txt`) head-to-head vs
|
|
535
|
+
alien-signals (time = median execution; heap = average transient delta-heap per rep;
|
|
536
|
+
lite-signal numbers are @1.9.0-preview, engine differs from 1.8.0 only in `effect`
|
|
537
|
+
and `createScope` by one existence-guarded `[Symbol.dispose]` stamp line each on the
|
|
538
|
+
cold creation path; sha256 over the 14 other propagation / flush-scaffold function
|
|
539
|
+
bodies matches pristine 1.8.0 byte-for-byte):
|
|
540
|
+
|
|
541
|
+
| Scenario | lite | alien | lite vs alien (time) | transient heap (lite / alien) |
|
|
542
|
+
| -------------------------------- | -------- | -------- | -------------------- | ----------------------------- |
|
|
543
|
+
| MUX (256 sigs -> sum -> effect) | 22.98 ms | 35.32 ms | **+34.9% faster** | 0 KB / 781 KB (100% less) |
|
|
544
|
+
| SELECTIVE DAG (set churn) | 2024 ms | 2558 ms | **+20.9% faster** | 7.7 MB / 76.5 MB (9.9x) |
|
|
545
|
+
| DYNAMIC DAG (FAN=6, read flips) | 3737 ms | 4453 ms | **+16.1% faster** | 3.4 MB / 55.7 MB (16.6x) |
|
|
546
|
+
| BROADCAST (1 -> 1000 effects) | 444.47 ms | 468.88 ms | **+5.2% faster** | ~0 KB / ~0 KB (both zero) |
|
|
547
|
+
| KAIROS (1 -> 1000 computeds) | 525.27 ms | 439.61 ms | -19.5% | 23 KB / 802 KB (34.3x) |
|
|
548
|
+
| DEEP CHAIN (256-deep -> effect) | 173.54 ms | 100.41 ms | **-72.8%** | 0.5 KB / 1062 KB (>2000x) |
|
|
549
|
+
|
|
550
|
+
lite-signal's time wins on the 1.9.0-preview M4 Pro sweep cluster on the
|
|
551
|
+
allocation-heavy dynamic shapes (object pool allocates near-nothing; alien churns the
|
|
552
|
+
nursery), plus MUX fan-in aggregation and BROADCAST -- the patterns that dominate live
|
|
553
|
+
UI under input churn. **Speed wins vs alien: 4/6** (MUX, SELECTIVE DAG, DYNAMIC DAG,
|
|
554
|
+
BROADCAST). The four wins hold within noise of the 1.8.0 M4 Pro sweep despite the two
|
|
555
|
+
`[Symbol.dispose]` stamp lines -- **BROADCAST narrowed** from +9.4% to +5.2% but
|
|
556
|
+
stayed on the win side of parity; **KAIROS widened** from -15.9% to -19.5%,
|
|
557
|
+
host-noise drift on the shape where lite is architecturally weakest. **DEEP CHAIN
|
|
558
|
+
-72.8%** is the same architectural weak spot the honest framing has always named. On
|
|
559
|
+
allocation, lite wins 5/6 shapes and is one to four orders of magnitude below alien
|
|
560
|
+
on every shape where GC pressure exists at all; the sixth is a shared-zero on
|
|
561
|
+
BROADCAST.
|
|
562
|
+
|
|
563
|
+
**The differentiated position is ALLOCATION, not raw propagation speed** -- competitive-
|
|
564
|
+
to-winning throughput with dramatically lower GC pressure, not "fastest dynamic-graph
|
|
565
|
+
engine". That headline reproduces across hosts, sweeps, and third-party version bumps
|
|
566
|
+
because the object pool is the mechanism, not a tuning knob.
|
|
567
|
+
|
|
568
|
+
Mirror sweep (`bench/rb.txt`, Andrii's canonical adapter verbatim, isolated-per-row,
|
|
569
|
+
10 reps, lite vs alien only on the same M4 Pro host) reproduces the same picture
|
|
570
|
+
across all 47 shapes: lite runs parity-to-behind alien on throughput, wins outright
|
|
571
|
+
on **3/47**: `1000x5 - 25 sources (wide dense)` +10.7%,
|
|
572
|
+
`manySourcesIntoOneComputedEffectWithDirect` +31.5%, `manySourcesIntoOneComputedEffect`
|
|
573
|
+
+30.2%. `molBench` dropped from a razor-thin +0.3% win on 1.8.0 to -0.4% parity this
|
|
574
|
+
sweep, taking the outright-win count from 4/47 to 3/47. Weak on the deep/layered-burst
|
|
575
|
+
family. Every row carries a `#STAMP` and the counters (`nodesRecomputed` /
|
|
576
|
+
`edgesTraversed` / `sinkReads`) match Andrii's published suite exactly, so a
|
|
577
|
+
lite-vs-alien delta here is identical work, not DCE. Retracking verified correct by
|
|
578
|
+
`retracking.difftest.mjs` (20,000 direct + 10,000 batched writes, 0 disagreements
|
|
579
|
+
vs published 1.1.5).
|
|
580
|
+
|
|
581
|
+
**Andrii Volynets js-reactivity-benchmark position: 3rd of 15** (up from 4th on every
|
|
582
|
+
sweep before 1.8.0) with geomean **95.4 ms** (raw log
|
|
583
|
+
`bench/AndriiVolynetsReactiveBench.log`; byte-identical to 1.8.0's log because the
|
|
584
|
+
1.9.0-preview engine is sha256-identical to 1.8.0 on all 14 propagation / flush
|
|
585
|
+
functions -- only `effect` and `createScope` gain one existence-guarded
|
|
586
|
+
`[Symbol.dispose]` stamp line each on the cold creation path). Behind alien-signals
|
|
587
|
+
(77.5), reflex (89.7). Ahead of @reactively (136.0, lite 1.43x faster), Preact Signals
|
|
588
|
+
(148.8, ~56%), uSignal (195.4), $mol_wire (206.5), @amadeus-it-group/tans (210.4),
|
|
589
|
+
@vue/reactivity (229.4, 2.4x), Oby (242.5), Signia (307.0, 3.2x), MobX (388.3, 4.1x),
|
|
590
|
+
@solidjs/signals (420.6, 4.4x), s-js (480.1), SolidJS (733.5, 7.7x). **20 outright
|
|
591
|
+
wins**: the eight canonical propagation shapes (avoidablePropagation, broadPropagation,
|
|
592
|
+
deepPropagation, diamond, mux, repeatedObservers, triangle, unstable), all four wide
|
|
593
|
+
fan-in / fan-out shapes (manyEffectsFromOneSource, manySourcesIntoOneComputedEffect,
|
|
594
|
+
manySourcesIntoOneComputedEffectWithDirect, manySourcesIntoOneDirectEffect), molBench,
|
|
595
|
+
and seven of the rectangular / layered DAG shapes. Top-3 count: 29/47. lite-signal is
|
|
596
|
+
the only object-pooled, zero-GC engine in the field.
|
|
571
597
|
|
|
572
598
|
Retained heap after forced GC: typically negative for all libs (V8 compacts).
|
|
573
|
-
The one exception: lite-signal shows ~+
|
|
599
|
+
The one exception: lite-signal shows ~+23 KB retained on KAIROS, which is the
|
|
574
600
|
pre-allocated pool holding the live 1002-node graph in steady state. This is
|
|
575
601
|
the design: the pool IS the working memory. Not a leak.
|
|
576
602
|
|
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.2",
|
|
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",
|