saved
dquickts: QuickJS with durable execution
Hraness wrote this summary from a saved copy of the source. Quotations are taken word for word from the source.
gist
dquickts is Stencil's fork of Fabrice Bellard's QuickJS that can suspend running JavaScript, snapshot the whole heap and resume it elsewhere. Snapshots store indexes instead of pointers; a full snapshot of an empty runtime is about 13 KB, while deltas against a reproducible base can be 128 bytes. It also runs TypeScript by erasing types at parse time, ships a qjs --drepl REPL that survives restarts, and vendors rquickjs 0.14.0 Rust bindings. The C repository, created October 19, 2026 and committed mainly by Can Bölük, has 93 stars, no releases and an MIT license.
ideas
- Suspension reuses the async frame machinery. At interrupt safepoints, every 10,000 branches by default, a fully suspendable stack moves into heap frame objects like an async function at an await; frames entered from native code such as getters, Proxy traps or callbacks defer the request.
- Deltas are byte diffs, not dirty bits. The runtime keeps each base cell's encoded body and writes only changed or new cells, often as prefix and suffix patches, so changing a global object with a hundred properties costs about twenty bytes.
- Durable host calls park a script on an outside answer. A C function returns JS_SuspendCall(), the process can snapshot and exit, and a later process finishes the call with JS_ResumeWith(), so fetch(url) reads as an ordinary synchronous call.
- Hosts must rebuild the same native registry. Snapshots load only into the same engine build with the same natives in the same order, runtime configuration is not saved, and Intl, Temporal, shared buffers and C closures cannot be written.
- TypeScript follows tsc with isolatedModules. There is no type checking; enums, namespaces, parameter properties and decorators compile to bytecode, while JSX, TSX and export = are rejected.
quotes
“serialize its whole heap to bytes, and resume it later in a different process”
“Because of this rule, the engine never has to save a C stack.”
“Snapshots are trusted input, like bytecode.”