[英]What is the difference between nodejs packages workerpool & worker_threads?
Am new to JavaScript/NodeJs.我是 JavaScript/NodeJs 的新手。 I tried to understand the difference between child_process , cluster & worker_threads and then confused after finding another module called workerpool so could you tell the difference between worker_threads and workerpool in short, please?我试图理解child_process 、 cluster和worker_threads之间的区别,然后在找到另一个名为workerpool的模块后感到困惑,所以你能简单地说一下worker_threads和workerpool之间的区别吗?
workerpool
provides a pool of worker threads that it uses to run things: threads that can be reused, a new thread doesn't have to be created every time. workerpool
提供了一个用于运行事物的工作线程池:可以重用的线程,不必每次都创建一个新线程。 As it says in the second sentence of the npm
description, it implements the worker pool pattern .正如它在npm
描述的第二句中所说,它实现了工作池模式。 worker_threads
just provides a means of creating and using worker threads, it doesn't provide pooling. worker_threads
只是提供了一种创建和使用工作线程的方法,它不提供池。 (Also, workerpool
supports both Node.js and browsers, but worker_threads
is of course Node.js specific.) (此外, workerpool
支持 Node.js 和浏览器,但worker_threads
当然是 Node.js 特定的。)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.