Isoloop 0.1: a preface to Isoloop Insides
It's been a while since I last posted something here… Six years and two days, but I hope this changes for the better. I currently started working on an ambitious library, called Isoloop. Its first release, 0.1.0, went ou
It's been a while since I last posted something here… Six years and two days, but I hope this changes for the better. I currently started working on an ambitious library, called Isoloop. Its first release, 0.1.0, went out on npm on 23 November 2026, and 0.1.1, a patch with fixes and no API changes, is the current one.
This is the preface to a series, Isoloop Insides. Later articles take the pieces one at a time, in more depth.
The problem
In most apps, the UI and everything behind it, such as state, sync, search and data processing, share one main thread, one heap and one event loop. One slow or broken part makes the whole app janky or blank.
A sandbox isolates globals and styles, but not CPU time or crashes. A plain worker isolates CPU time, but it leaves you to wire up how independent parts share data, and what happens when one of them fails.
What Isoloop is
Isoloop is event-loop isolation for JavaScript apps: an open-source TypeScript library, MIT-licensed, that lets you separate your app's UI from the work behind it.
Each part of the app runs as an isolate, on its own worker (a thread with its own heap and event loop) or in a shared pool (one worker that several isolates share). An isolate can be a UI part, written in React, Preact or plain DOM, or a headless one with no UI. The page's main thread only applies what the UI parts draw.
How you split your app is your call. One pattern is to keep the UI parts to the UI and move state, data processing and other heavy work into headless isolates, a bit like controllers behind a view. A UI isolate can still hold its own state; nothing forces the split.
Parts can share state through a message bus that keeps its records. The bus is optional, but it's the usual way headless parts share state with the UI. A supervisor restarts a part that fails, and with the bus it catches up from the records the bus kept.
That keeps the UI responsive and contains a block or a crash to its part, while the rest of the app keeps running. It also lets the work run where it fits best, on its own worker or in a pool, with the same code.
How it works, in one pass
- The kernel runs on the main thread. It starts the bus, when there is one, and the isolates, supervises them, and is the only code that writes to the real DOM.
- A topic is a named, versioned channel with a schema. Each isolate's grants list the topics it may publish and subscribe to.
- The bus runs in a worker of its own and checks every record against its topic's schema. Each topic keeps its records by a rule, such as the last 500 or the last minute, and a subscriber can replay them. A topic set to
persistentis also written to the browser's origin-private file system and survives a reload. - Placement is a setting: the same isolate runs on its own worker or in a named pool, chosen when it's started.
- Each worker sends a heartbeat every 100 ms. After 400 ms without one, its isolate is marked blocked, and a beat that arrives brings it back with no restart. After 10 s without a beat by default, or on a crash, the kernel restarts it, up to its restart limit, and its subscriptions start again from the point each one names. In a pool, a member's own fatal error or ready timeout restarts it alone, in the running worker; the whole pool restarts when that worker stops beating or fails.
0.1 runs in browsers. Several APIs are marked experimental and may change in any minor; the docs mark each one. The Limits page says what it can't do; for one, it isn't a security boundary.
What it costs
An Isoloop build adds workers, a bus and a kernel, and that takes CPU, memory and start-up time. The numbers come from the plant dashboard, an example app for a fictional plant with 8 machines and 72 widgets. It's a telemetry dashboard built three ways: plain native (everything on the main thread), native + workers (a data worker per machine, the widgets on the main thread), and Isoloop.
The run is plant-bench on @isoloop/*@0.1.0: React 19.3.1, an x64 machine with four CPUs at 2.0 GHz, Ubuntu 24.04.5, Chromium 158, vibration at 5 kHz, 5 interleaved rounds, on 2026-11-24 (environment). Each difference is the median of the per-round differences. Isoloop runs in matched, the plant build's default placement: 10 workers plus the bus worker. There the 72 widgets share one pool, so a block stalls them all, while each machine's data pool keeps running.
| Figure | native + workers | Isoloop matched
|
Difference |
|---|---|---|---|
| Main-thread busy | 78% | 24% | −54 points, all 5 rounds |
| Typing | 58 ms | 41 ms | −18 ms; rounds from −40 to +1 ms |
| Recovery after a 3 s block | 3.2 s | 2.9 s | −248 ms, all 5 rounds |
| All 72 widgets with data | 2.3 s | 1.5 s | −787 ms; rounds from −813 to +157 ms, so not all agree |
| CPU, all threads | 97% | 112% | +19 points, all 5 rounds |
| First data | 366 ms | 557 ms | +207 ms, all 5 rounds |
| Memory after GC | 227 MB | 272 MB | +46 MB, all 5 rounds |
Main-thread busy and CPU are shares of one core over 10 s with no input. Typing is the median of 5 keystrokes into a widget's filter, until the widget shows the text. First data runs from navigation until the first gauges appear. Memory is read after a forced garbage collection in the page and every worker. Recovery runs from a click that blocks one machine's gauges for 3 s until that machine's gauges, sensor table and temperature trend show data from after the click. The bench sets the kernel to kill a loop busy for 2 s, so the blocked pool restarts and catches up from the bus.
In Firefox 159 at 5 kHz, matched against native + workers, recovery went the other way, 320 ms longer (343 ms at 1 kHz), and so did all 72 widgets with data: 1.9 s against 1.5 s, +377 ms, rounds from −606 ms to +1.3 s. First data was later there too, by 558 ms, while typing was lower with Isoloop. WebKit's typing figure came out much slower with Isoloop; it's under investigation in isoloop/web#326, and the site leaves off WebKit's figures.
The native builds don't contain a blocked widget, restart a crashed one, replay data to it, or check grants or schemas. The extra CPU and memory pay for those.
Minified and gzipped with Vite 8.3.7, without React or Preact, the page code that creates the kernel is 22.8 KB, the bus worker 20.4 KB and the isolate worker 14.9 KB, on a 0.1 preview (guide).
The horizon
Where I want to take it: go beyond web workers to native workers, support for Tauri, move things to WASM, support for multiple libraries.
These are steps in one direction: the work moves further from the UI, and the bus matters more the further it goes. Today the bus is optional. Once the work runs outside the browser, it becomes the model the UI and the work share. None of it has a date; the roadmap has the order.
- Data processing without isolate code (proposed): a topic can carry a plan, such as filter, window, group and aggregate, and a headless isolate the kernel owns keeps it up to date.
- WASM (planned): an opt-in Rust/WASM engine for the bus, benchmarked against the TypeScript one, and shipped only if it does better.
- Tauri (proposed): a package that gives a desktop app native storage for persistent topics and native commands its isolates can reach.
- Native runtimes (proposed): the runtime becomes part of placement, so a headless isolate can run as a WASM component or a native process in a Tauri app's core, by changing placement, not code. A JS isolate compiled to a WASM component runs without a JIT, so it's measured against a worker and the result published, whatever it shows. When it ships is still open.
- Node and Bun hosts, through
worker_threads, aren't planned yet; they're 2.0 scope. - More libraries (planned): Vue 3, Svelte 5 and Solid 1 adapters.
Read more
- Features
- How it works
- Benchmarks
- Docs
- The plant dashboard, with its native and Isoloop builds
- The code: github.com/isoloop/isoloop
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.