December 5, 2025

Threads, thrills, and foot-guns

The missing standard library for multithreading in JavaScript

JavaScript finally learns to multitask—cheers, side-eye, and foot-gun warnings

TLDR: Multithreading.js promises painless background helpers, shared memory, and safety locks so JavaScript can finally multitask. The crowd is split: fans see a Go/Bun replacement, skeptics warn about hidden gotchas like scope and move() “foot-guns,” and everyone wonders if WebAssembly threads are next.

JavaScript just got its “missing” multitasking toolkit, and the crowd split into clapping hands and raised eyebrows. Multithreading.js promises true parallel vibes using Web Workers (background helpers), a managed thread pool, and safety locks like Mutexes (a padlock so data isn’t trampled). The flashy bit: SharedJsonBuffer, a shared “notebook” that avoids constant copying. Hype rolled in fast—christophilus says this might let them choose Bun instead of Go, and Zedriv dreams of multithreaded WebAssembly next. Wrs drops meme-wisdom: any complex worker setup ends up reinventing this library anyway.

Then the drama. Bastawhiz warns a stubborn rule remains: worker code can’t peek outside, so imports must happen inside the worker function—your editor won’t catch it, your app will crash. Petesergeant praises the docs but calls move() a “foot-gun,” since it clones some data and “moves” others, even blocking arrays you pass. The vibe is excited, cautious, and meme-ready: power users want speed and safety; skeptics fear silent gotchas. Multithreading.js arrives with fireworks and safety goggles, and the comments are already arguing whether this is the fix, or just a nicer way to touch the stove.

Key Points

  • Multithreading.js introduces Rust-inspired concurrency primitives to JavaScript via a managed thread-pool and strict memory safety.
  • The library abstracts Web Worker, serialization, and SharedArrayBuffer complexities to make multithreaded code resemble async JavaScript.
  • Core features include a managed worker pool, shared memory tools to prevent race conditions, scoped imports, and move semantics.
  • The spawn API runs tasks in separate workers and returns a handle; join awaits results with success or error handling.
  • SharedJsonBuffer plus Mutex enables efficient shared JSON state with automatic serialization and partial re-serialization of changed bytes.

Hottest takes

"Any complicated app with workers secretly reimplements half of this" — wrs
"If you reference something lexically, your code fails at runtime" — bastawhiz
"This’ll let me reach for Bun where I used Go" — christophilus
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.