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
/
fixed-worker-nodes.js
diff --git
a/benchmarks/versus-external-pools/fixed-worker-nodes.js
b/benchmarks/versus-external-pools/fixed-worker-nodes.js
index 58965d212c88e8e50acc70ada69c85afe4b470f5..d5b01353d2eb0a9c54272e9619080bec92d7bebb 100644
(file)
--- a/
benchmarks/versus-external-pools/fixed-worker-nodes.js
+++ b/
benchmarks/versus-external-pools/fixed-worker-nodes.js
@@
-1,11
+1,13
@@
+'use strict'
// IMPORT LIBRARIES
const WorkerNodes = require('worker-nodes')
// FINISH IMPORT LIBRARIES
// IMPORT LIBRARIES
const WorkerNodes = require('worker-nodes')
// FINISH IMPORT LIBRARIES
-const size =
Number
(process.env.POOL_SIZE)
-const iterations =
Number
(process.env.NUM_ITERATIONS)
+const size =
parseInt
(process.env.POOL_SIZE)
+const iterations =
parseInt
(process.env.NUM_ITERATIONS)
const data = {
test: 'MYBENCH',
const data = {
test: 'MYBENCH',
- taskType: process.env['TASK_TYPE']
+ taskType: process.env.TASK_TYPE,
+ taskSize: parseInt(process.env.TASK_SIZE)
}
const workerNodes = new WorkerNodes(
}
const workerNodes = new WorkerNodes(
@@
-18,12
+20,21
@@
const workerNodes = new WorkerNodes(
)
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
(workerNodes.call.functionToBench(data))
+ promises.
add
(workerNodes.call.functionToBench(data))
}
await Promise.all(promises)
}
await Promise.all(promises)
+ // eslint-disable-next-line n/no-process-exit
process.exit()
}
process.exit()
}
-run()
+(async () => {
+ try {
+ await run()
+ } catch (e) {
+ console.error(e)
+ // eslint-disable-next-line n/no-process-exit
+ process.exit(1)
+ }
+})()