-
-
Notifications
You must be signed in to change notification settings - Fork 37.1k
worker: motivating examples? #33880
Copy link
Copy link
Closed
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.questionIssues asking questions about Node.js.Issues asking questions about Node.js.workerIssues and PRs related to the worker_threads module and Worker API.Issues and PRs related to the worker_threads module and Worker API.
Description
Activity
Metadata
Metadata
Assignees
Labels
docIssues and PRs related to Node.js documentation.Issues and PRs related to Node.js documentation.questionIssues asking questions about Node.js.Issues asking questions about Node.js.workerIssues and PRs related to the worker_threads module and Worker API.Issues and PRs related to the worker_threads module and Worker API.
I'm having a hard time figuring out when I would actually want to use workers over a child process.
The docs provide the following motivation:
However, I'm having a hard time finding a case where I would actually use this. Usually I would have either strings or objects that I would like to pass onto a worker. Maybe something like https://capnproto.org/ could take advantage of this? But from what I can see such approaches are actually quite slow in javascript.
Also, from what I understand actually transferring Buffers to workers have some edge cases and could fallback to become a copy.
I'm not saying it's a bad feature. I would really love to try it out and use it. I'm just having trouble finding the use case for it.
Maybe someone could provide some ideas/examples of when this would be useful would be helpful as a point of inspiration?