3 ms·
Node does have worker threads. They’re awkward because no shared memory, lots of serialization overhead and boiler plate, but if you’ve got heavy data processin
by yashap 5y ago
Node does have worker threads. They’re awkward because no shared memory, lots of serialization overhead and boiler plate, but if you’ve got heavy data processing to do on say a 4-8 CPU machine, you can certainly split it up between 4-8 CPU threads.
- hajile 5y agoNode supports SharedArrayBuffer. It’s not perfect, but is usable. In truth, assemblyscript or rust running in wasm is probably the best solution going forward.
- yashap 5y agoTrue, but regardless, the kind of ergonomic, low overhead parallel computing available in Scala or Go just isn’t possible in Node. In Scala or Go, parallel computing is barely anymore difficult than synchronous computing, in Node it’s quite the pain in the ass once you want to start passing objects with methods and whatnot between threads.
- SavantIdiot 5y agoThat's process parallelism, not compute parallelism. To radically different things. I've avoided using node worker threads in favor child.fork, which then resolves to IPC through process.on and process.send, which is like any other process management.