repositories
/
poolifier.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
chore: v2.4.0
[poolifier.git]
/
benchmarks
/
versus-external-pools
/
fixed-threadwork.js
diff --git
a/benchmarks/versus-external-pools/fixed-threadwork.js
b/benchmarks/versus-external-pools/fixed-threadwork.js
index dfba6c00f645ccd46b27d8b26513643212a82794..d21fae6a8e2179704af88fb420c40f2c338deb1a 100644
(file)
--- a/
benchmarks/versus-external-pools/fixed-threadwork.js
+++ b/
benchmarks/versus-external-pools/fixed-threadwork.js
@@
-1,24
+1,20
@@
// IMPORT LIBRARIES
// IMPORT LIBRARIES
-const
{ ThreadPool } = require('
threadwork')
+const
threadPool = require('./pool-
threadwork')
// FINISH IMPORT LIBRARIES
// FINISH IMPORT LIBRARIES
-// IMPORT FUNCTION TO BENCH
-const functionToBench = require('./functions/function-to-bench')
-// FINISH IMPORT FUNCTION TO BENCH
-const size = process.env.POOL_SIZE
-const iterations = process.env.NUM_ITERATIONS
+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 threadPool = new ThreadPool({ task: functionToBench, size: size })
-
async function run () {
const promises = []
for (let i = 0; i < iterations; i++) {
promises.push(threadPool.run(data))
}
await Promise.all(promises)
async function run () {
const promises = []
for (let i = 0; i < iterations; i++) {
promises.push(threadPool.run(data))
}
await Promise.all(promises)
+ // eslint-disable-next-line n/no-process-exit
process.exit()
}
process.exit()
}