Reflex QuantSignals with norecursion

A 2.2 KB JavaScript reactive runtime. Exact dependency tracking, glitch-free, one explicit stack on every path.

npm i reflex-quantSee how it works →

A JavaScript signals runtime of about 2.2 KB gzip: signals, computeds and effects, with exact dynamic dependency tracking, glitch-free propagation, and no recursion on any path.

npm install reflex-quant

Quant is a research project as much as a library. It asks one question: what is the smallest reactive machine we can derive from a fixed semantic contract, with every retained mechanism justified by a counterexample? Each mechanism has one showing that this implementation breaks the contract, or a structural bound, without it. That makes it the smallest known set, not a proven lower bound. Nothing is in it because another framework has it.

Fine-grained reactivity in one example

A computation depends on exactly what its last run read, so dependencies change from run to run:

import { computed, effect, get, set, signal } from "reflex-quant";

const full = signal(false);
const first = signal("Ada");
const last = signal("Lovelace");
const name = computed(() => (get(full) ? `${get(first)} ${get(last)}` : get(first)));

effect(() => console.log(get(name))); // "Ada"        name reads full, first
set(last, "Byron");                   // nothing runs: last was not read
set(full, true);                      // "Ada Byron"  name now reads last too
set(full, false);                     // "Ada"        last is dropped again
set(last, "King");                    // nothing runs
runs reflex-quant 1.1.2 in your browser

What makes Quant different

A computed can own state, not just cache a derivation

computed(fn, initial) passes fn its last committed value. That turns a computed into a state transition: it keeps its own state in prev, takes causes in through reads, and sends consequences out through writes.

Game of Lifegenerationworld(prev)cellsthe world is the computed's own valuea fireflytickinboxA(prev)writeinbox Breads in, messages out
Reads form dependencies. Writes carry messages. prev carries local state.

One small machine, three kinds of computation. Game of Life: state evolves, the whole world is one computed. Fireflies: events propagate, and the runtime itself finds the fixpoint. Constraints: knowledge converges, until no cell can rule out anything more.

Performance

0.45×of alien-signals' time (geomean)
0.99×of Reflex's time
1.03×only 3 % behind an oracle that picks the faster rival in every scenario (geomean)
Faster than both rivals7 / 18
Within 25 % of the faster rival17 / 18
More than 25 % slower1 / 18
18 scenarios, lower time is better. CI run 42794143933; the suite is this project's own.

Reflex remains faster on reorders and sorts (Quant takes 1.20–1.43× its time there). Against alien-signals, the difference on reorders is structural:

256 dependencies, rotated every pass
edges creatededges removed
Reflex Quant00
alien-signals 3.2.1255255
Same dependency set. Different structural work. Reproduce: node bench/structure.mjs.

More: benchmarks and methodology, alien-signals vs Reflex Quant, Vue reactivity vs signals.

Read next

FAQ

What is Reflex Quant?

A JavaScript and TypeScript signals library (signal, computed, effect) of about 2.2 KB gzip, derived from a fixed reactive contract, with every retained mechanism justified by a counterexample.

Is Reflex Quant production ready?

Quant is usable as a library, but it is a research-driven runtime, not a mature dependency with years of production deployment. It is published on npm under MIT, tested differentially against an executable specification on over 140,000 programs, and benchmarked on every CI build. Read the contract before relying on edge-case behaviour.

Does Reflex Quant work with React, Vue or Solid?

Quant is framework-agnostic: it has no rendering layer. It can back state in any framework through an adapter that subscribes with effect().