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-hybrid...
[poolifier.git]
/
benchmarks
/
versus-external-pools
/
fixed-poolifier.mjs
diff --git
a/benchmarks/versus-external-pools/fixed-poolifier.mjs
b/benchmarks/versus-external-pools/fixed-poolifier.mjs
index aa922be8a9928651519572177eeb728cb9fe72b3..5efd786e562d1d6acabe2ad2981ccd2754fbe42e 100644
(file)
--- a/
benchmarks/versus-external-pools/fixed-poolifier.mjs
+++ b/
benchmarks/versus-external-pools/fixed-poolifier.mjs
@@
-1,6
+1,6
@@
-// IMPORT LIBRARIES
import { FixedThreadPool } from 'poolifier'
import { FixedThreadPool } from 'poolifier'
-// FINISH IMPORT LIBRARIES
+import { executeAsyncFn } from './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 = {
@@
-9,19
+9,22
@@
const data = {
taskSize: parseInt(process.env.TASK_SIZE)
}
taskSize: parseInt(process.env.TASK_SIZE)
}
-const fixedPool = new FixedThreadPool(
+const fixed
Thread
Pool = new FixedThreadPool(
size,
size,
- './workers/poolifier/function-to-bench-worker.mjs'
+ './workers/poolifier/function-to-bench-worker.mjs',
+ {
+ enableTasksQueue: false
+ }
)
async function run () {
)
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(fixe
dPool.execute(data))
+ promises.
add(fixedThrea
dPool.execute(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()
}
-await
run(
)
+await
executeAsyncFn(run
)