TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Any good Node.js parallelization libraries?

1 点作者 thatxliner超过 2 年前
Or do I have to use something along the lines of Web Workers or NodeJS Worker Threads? I would prefer it if I had an API similar to Python’s concurrent.futures. What I really want is apply a function to an array in parallel (i.e. some parallel version of .map)

4 条评论

rektide超过 2 年前
Some ground info, Node has worker_threads for this purpose. <a href="https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;worker_threads.html" rel="nofollow">https:&#x2F;&#x2F;nodejs.org&#x2F;api&#x2F;worker_threads.html</a><p>I haven&#x27;t had cause to use it yet, but I very much trust&#x2F;respect the team behind: <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;piscina" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;piscina</a> . It&#x27;s so popular it has well maintained forks, such as tinypool, <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;tinypool" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;tinypool</a> .<p>Also seeing good npm popularity metrics around: <a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;synckit" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;synckit</a>
SvenL超过 2 年前
We used piscina at it was quite good: <a href="https:&#x2F;&#x2F;github.com&#x2F;piscinajs&#x2F;piscina">https:&#x2F;&#x2F;github.com&#x2F;piscinajs&#x2F;piscina</a><p>While it may not provide parallel map out of the box it will help to implement it a little bit easier than using nodes api.
PaulHoule超过 2 年前
It is a single threaded runtime so to parallelize a map you will need to serialize the items and ship them to another node process. A bit like dask in Python.
normalhappy超过 2 年前
<a href="https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;paralleljs" rel="nofollow">https:&#x2F;&#x2F;www.npmjs.com&#x2F;package&#x2F;paralleljs</a>
评论 #34504202 未加载