r/javascript • u/alexp_lt • 20h ago
TabBench: benchmarking Linux-in-browser implementations - Unkernel vs. WebVM vs. BrowserPod
https://github.com/leaningtech/tabbenchTabBench is a reproducible benchmark suite for libraries that run Linux programs in a browser tab. It runs the same commands natively and in each runtime on the same machine, and reports each result as a ratio to native. Only the commands are timed, after everything has booted.
It currently support three runtimes:
- [unkernel](https://github.com/pithings/unkernel): the Linux kernel compiled to WebAssembly, running arm64 binaries on an emulated CPU
- [CheerpX](https://cheerpx.io): an x86-to-WebAssembly JIT, the engine behind WebVM
- [BrowserPod](https://browserpod.io): programs compiled to WebAssembly ahead of time, with JavaScript on the browser's own engine
The workloads are shell tools (sort, gzip, sha256sum, find and a shell loop) and Node tools (npm ci, ESLint, the acorn parser and a CPU benchmark from unkernel's tests).Results, as a ratio to native (lower is faster):
- Shell tools: BrowserPod 1.4–5.8×, CheerpX 3.6–8.9×, unkernel 4.1–22×
- JavaScript: BrowserPod 1.4–5.1×, CheerpX 32–58×, unkernel 33–49×
- npm ci: BrowserPod 9.6×, unkernel 31×
We plan to add other runtimes, such as v86, JSLinux, container2wasm and WebContainers.
Disclosure: I am the lead engineer and CTO of Leaning Technologies, we make BrowserPod and CheerpX. The test suite is public and can be replicated, and PRs from maintainers of other runtimes are welcome.
Full description and results: https://github.com/leaningtech/tabbench
•
u/Opposite_Sector2145 19h ago
If you want to replicate these TabBench results, make sure you use the exact commands listed in the README and run them after everything has finished booting. Timing before all initialization completes will give totally different numbers.
•
u/hyoahn 12h ago
Really cool benchmark suite! While testing
tabbenchlocally, I reproduced a server crash and found two small null-guard bugs:lib/server.mjs:26(URIError: URI malformedserver crash) &:18(prefixguard) A malformed URL likeGET /%E0%A4%AcausesdecodeURIComponent(new URL(req.url, "http://x").pathname)to throw an uncaughtURIErrorand terminate the Node server. WrappingdecodeURIComponentintry/catchand guarding!prefixkeeps the server up cleanly:targets/native.mjs:32(TypeErrorwhen/BENCH (\d+) (\d+)\n$/.exec(stdout)returnsnull) If a workload exits without printing the trailing timing marker, destructuring.exec(stdout)throws a genericTypeErrorinstead of surfacingstdoutcontext:Verified locally against
lib/server.mjs(GET /→200,GET /%E0%A4%A→400,GET /../package.json→404). Happy to open a tiny PR if you'd like!(P.S. Found these in a couple of seconds with XapBug —
npx xapbug/ https://xapbug.com — a local, zero-telemetry AST bug/leak checker for JS/TS/Python. Handy to run locally whenever you want to catch unguarded nulls or resource leaks fast before a run.)•
u/na-6381989 9h ago
For the JavaScript row, are Node version and build held constant across runtimes, or is that part of each port? That distinction would help interpret the gap.