
# Comparison

Where untainer sits next to tools that also run software that is not JavaScript, or not native,
on a developer's machine or in a browser. A short, factual comparison: what each runs, and where.

| | untainer | Docker | WebContainers | PGlite | container2wasm |
| --- | --- | --- | --- | --- | --- |
| Runs | OCI images (linux/arm64) | OCI images | Node.js applications, not container images | Postgres only | OCI images (amd64 and riscv64; others with an extra QEMU user emulation) |
| In a browser | yes | no | yes | yes | yes |
| In Node | yes | through a daemon | no | yes | through a WASI runtime (wasmtime, wazero...) |
| How | Linux kernel compiled to WebAssembly, aarch64 user space emulated | native Linux (a VM on macOS and Windows) | a runtime for Node.js inside the tab; needs cross-origin isolation | Postgres compiled to WebAssembly, a library with one connection | a machine emulator compiled to WebAssembly (Bochs for x86_64, TinyEMU for RISC-V, QEMU in browsers) running a Linux kernel |
| Image download | lazy: the chunks a container reads | the whole image | npm packages | the library | the whole converted image |
| Network in | `publishPort()` (Node) | yes | to the page: a server's URL (`server-ready`) | with a separate package (`pglite-socket`) | with its `c2w-net` helper (`-p`) |

## When to use which

- **Docker**: when you can run it, for production and anything performance-sensitive. untainer is
  for where Docker is not: a browser tab, a test runner without Docker, a demo.
- **WebContainers**: for Node.js applications in a browser IDE (commercial production use needs a
  license). untainer runs container images, any linux/arm64 one, Node.js among them, at the cost
  of an emulated user space, and needs no cross-origin isolation.
- **PGlite**: for Postgres as a library in a JavaScript process, small (under 3 MB gzipped, as
  its documentation says) and fast to start.
  untainer runs the official Postgres image, with its extensions and tools (`psql`, `pg_dump`), as
  one container among others.
- **container2wasm**: converts an image into one WebAssembly program, run whole. untainer keeps
  images as static chunks fetched as they are read. Measured below.

## Measured against container2wasm

Every configuration measured, on one Linux arm64 host (Docker on macOS, M4 Pro; not CI), from
local files, three runs each ([`spikes/32-c2w/`](https://github.com/OskarLebuda/untainer/tree/main/spikes/32-c2w), 2026-12-05 and 2026-12-06;
container2wasm v0.8.5, wasmtime 27.0.0, Chromium of Playwright 1.65.2). They differ in what
runs the image: untainer runs its arm64 user space on a Linux kernel compiled to WebAssembly;
each container2wasm target runs a machine emulator compiled to WebAssembly, with a kernel and the
image inside it, all in one file.

| Configuration | What runs the image | node:24-alpine: size; `node -e "console.log(process.version)"` | postgres:17-alpine: size; ready (initdb, then the server) |
| --- | --- | --- | --- |
| untainer, Node | arm64 user space on unkernel; the CLI | 61.2 MB on disk, read as needed; 0.97-0.99 s | 125.1 MB, read as needed; 6.8-6.9 s |
| untainer, Chromium | the same, the web entry, the VM in a worker | the same files; 1.26-1.38 s | the same files; 6.76-6.85 s |
| container2wasm, default (amd64) | x86_64 user space on Bochs, an x86 emulator; wasmtime | one 278.6 MB `.wasm`; 12.1-12.3 s | one 396.4 MB `.wasm`; does not start: initdb fails, its kernel has no System V shared memory |
| container2wasm, riscv64 | riscv64 user space on TinyEMU, a RISC-V emulator; wasmtime | not converted | one 326.3 MB `.wasm`; does not start: initdb fails, the same System V shared memory (it exits after 43.7-44.5 s) |
| container2wasm, aarch64 | arm64 user space on QEMU's user-mode emulation, inside TinyEMU; wasmtime | one 233.3 MB `.wasm`; 147.6-149.3 s | one 340.3 MB `.wasm`; does not start: a Go program in it stops at once ("runtime: cannot allocate memory") |
| container2wasm, `--to-js` | x86_64 on QEMU's JIT to WebAssembly, resuming a state saved when it was made, the command built in; Chromium | 294 MB of files; the version in 1 run of 3, after 175.6 s; in the other 2, nothing on its terminal for 20 min | not measured: its conversion was stopped, as it held the machine for too long (node's took 1,165 s) |

Making the images: `untainer build` takes 3.8 s for node:24-alpine with its layers cached and
22.2-25.5 s from an empty cache, most of it the download (on macOS,
[`docs/findings.md`](https://github.com/OskarLebuda/untainer/blob/main/docs/findings.md), "The real build, measured"); container2wasm, through Docker, 1,046 s
the first time for the default target, 8 s again with Docker's build cache. The details are in
[`docs/findings.md`](https://github.com/OskarLebuda/untainer/blob/main/docs/findings.md), "Against container2wasm".
