repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
build(deps-dev): apply updates
[poolifier.git]
/
benchmarks
/
versus-external-pools
/
dynamic-workerpool.mjs
diff --git
a/benchmarks/versus-external-pools/dynamic-workerpool.mjs
b/benchmarks/versus-external-pools/dynamic-workerpool.mjs
index 072aa6fd10fd3d77cf8ee0964bfeb494c16cee66..2fb02d4b5e7c2b37b3beb592f8a5adf550bd42e9 100644
(file)
--- a/
benchmarks/versus-external-pools/dynamic-workerpool.mjs
+++ b/
benchmarks/versus-external-pools/dynamic-workerpool.mjs
@@
-12,16
+12,16
@@
const dataArray = [
const workerPool = workerpool.pool(
'./workers/workerpool/function-to-bench-worker.mjs',
{
const workerPool = workerpool.pool(
'./workers/workerpool/function-to-bench-worker.mjs',
{
- minWorkers:
size
,
- maxWorkers: size
* 3
,
+ minWorkers:
Math.floor(size / 2)
,
+ maxWorkers: size,
workerType: 'thread'
}
)
async function run () {
workerType: 'thread'
}
)
async function run () {
- const promises =
[]
+ const promises =
new Set()
for (let i = 0; i < iterations; i++) {
for (let i = 0; i < iterations; i++) {
- promises.
push
(workerPool.exec('functionToBench', dataArray))
+ promises.
add
(workerPool.exec('functionToBench', dataArray))
}
await Promise.all(promises)
// eslint-disable-next-line n/no-process-exit
}
await Promise.all(promises)
// eslint-disable-next-line n/no-process-exit