concurrency-scalingAnswer last reviewed July 2026

So when does moving work onto a worker thread actually make things faster, and when does it quietly make them slower?

Good candidates price the offload first, serialization, scheduling, the clone back, and they know SharedArrayBuffer and Atomics are the escape hatch.

What an AI-prepared candidate might say

They help when the work is CPU-bound. So heavy parsing, compression, image manipulation, cryptography, that kind of thing, because those block the event loop and a worker gets them off the main thread. They don't help with I/O-bound work, Node already handles that asynchronously. And they can actually hurt when the tasks are small, because spawning threads and passing messages has overhead, which is why everyone uses a pool that reuses workers. The rule of thumb I've seen is that the computation should be big enough to outweigh the cost of sending the data over and getting the result back. Then SharedArrayBuffer lets threads share memory instead of copying it, and Atomics gives you safe reads and writes and waiting on that shared memory. That's how you avoid races when multiple threads are touching the same buffer.

Senior
Locked

The actual offload arithmetic, compute against the clone both ways, why the JSON.parse example usually loses, and the thing Atomics.wait does on Node's main thread.

Unlock the depth
Staff
Locked

The before-and-after numbers I make teams collect, the GC signature clone-heavy designs leave behind, and when the honest answer is leaving Node entirely.

Unlock the depth
Follow-up chain
So when does moving work onto a worker thread actually make things faster, and when does it quietly make them slower? | NodeBook