repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge dependabot/npm_and_yarn/examples/typescript/http-server-pool/express-worker_thr...
[poolifier.git]
/
benchmarks
/
versus-external-pools
/
fixed-tinypool.mjs
diff --git
a/benchmarks/versus-external-pools/fixed-tinypool.mjs
b/benchmarks/versus-external-pools/fixed-tinypool.mjs
index 0875e3f4d513b1a737a908da80bf44d5d46548e9..7063b5b957891f79496a83f65a7b83510cc314d2 100644
(file)
--- a/
benchmarks/versus-external-pools/fixed-tinypool.mjs
+++ b/
benchmarks/versus-external-pools/fixed-tinypool.mjs
@@
-1,6
+1,6
@@
-// IMPORT LIBRARIES
import Tinypool from 'tinypool'
import Tinypool from 'tinypool'
-// FINISH IMPORT LIBRARIES
+import { executeAsyncFn } from '../benchmarks-utils.mjs'
+
const size = parseInt(process.env.POOL_SIZE)
const iterations = parseInt(process.env.NUM_ITERATIONS)
const data = {
const size = parseInt(process.env.POOL_SIZE)
const iterations = parseInt(process.env.NUM_ITERATIONS)
const data = {
@@
-10,20
+10,20
@@
const data = {
}
const tinypool = new Tinypool({
}
const tinypool = new Tinypool({
- filename: './workers/tinypool/function-to-bench-worker.js',
+ filename: './workers/tinypool/function-to-bench-worker.
m
js',
minThreads: size,
maxThreads: size,
idleTimeout: 60000 // this is the same as poolifier default
})
async function run () {
minThreads: size,
maxThreads: size,
idleTimeout: 60000 // this is the same as poolifier default
})
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
(tinypool.run(data))
+ promises.
add
(tinypool.run(data))
}
await Promise.all(promises)
// eslint-disable-next-line n/no-process-exit
process.exit()
}
}
await Promise.all(promises)
// eslint-disable-next-line n/no-process-exit
process.exit()
}
-
run(
)
+
await executeAsyncFn(run
)