Closed thisconnect closed 7 years ago
For the WebWorker API this module is compatible with https://www.npmjs.com/package/tiny-worker — perhaps try both, benchmark, and switch as needed?
webworker-threads lets you offload computation using the WebWorker API, so you can write code against the WebWorker API and it will work in the browser or in Node. The Node child process module is Node-specific so your code wouldn't be portable.
You could support the WebWorker API using child processes instead of webworker-threads. webworker-threads has lower communication overhead and resource consumption than child processes would, but the tradeoff is that webworker-threads is (at the moment) a bit harder to program in. For example, require
won't work in webworker-threads right now; see #113.
@davisjam thanks that was the answer I was looking for
What is the difference https://nodejs.org/api/child_process.html ?
When would you use child process and when would you use webworker-threads?