Quench — a JavaScript engine in Rust where every tier is the interpreter, specialized
Quench is a JavaScript engine written in Rust. One interpreter holds the semantics; the copy-and-patch JIT, the Cranelift JIT and AOT are derived from it by specialization, and every level is measured in instructions against C.
What Quench Is
Quench runs JavaScript and WebAssembly with Node-compatible APIs. OXC parses the source once, a compiler turns it into register bytecode, and an interpreter runs it. Hot loops and functions move to native tiers: b-jit, which copies and patches machine-code stencils, and u-jit, which generates code with Cranelift. Native code leaves through a status word and the interpreter resumes at the exact bytecode position. MIT licensed.
Futamura Projections as the Design
- Each operation's meaning is written once, generic over a stage: run concretely it computes, run on the emitter it writes Cranelift IR, run at build time it becomes b-jit stencils.
- Check once: a dynamic fact is proved at most once per lifetime of the value or region that carries it.
- Reactive, not guarded: rarely changing facts such as shapes and callee identity are dependencies that invalidate what relied on them.
- O(1) per operation on hot paths.
- C-level residuals: generated code is judged against the C a programmer would write for the same program.
Measured Against C
Every level has a C reference and a shrink-only ceiling: per-operation instruction budgets, primitives per tier, kernels against C twins, and whole JetStream 3 benchmarks. Instruction counts from callgrind are the unit, because wall time on shared machines drifts. test262 runs in interpreter and JIT modes before changes merge.
Where It Stands
JetStream 3 without JIT, on the 56 tests that Quench, Node --jitless and Bun with JIT off all finish (17 November 2026): Quench scores 34.3 (geomean) against Node 39.7 and Bun 32.2, at 28.5 MB peak memory against 110.1 MB and 47.7 MB.
Goals
- Interpreter: 1.5x the score of the best of Node and Bun without JIT, at half their memory.
- Tiers: no-jit < b-jit < u-jit at every level, with u-jit within 5x of the equivalent C.