"threadjs",
"THREADPOOL",
"threadwork",
+ "tinypool",
"trimmable",
"tsdoc",
"typedoc",
--- /dev/null
+// IMPORT LIBRARIES
+import Tinypool from 'tinypool'
+// FINISH IMPORT LIBRARIES
+const size = parseInt(process.env.POOL_SIZE)
+const iterations = parseInt(process.env.NUM_ITERATIONS)
+const data = {
+ test: 'MYBENCH',
+ taskType: process.env.TASK_TYPE,
+ taskSize: parseInt(process.env.TASK_SIZE)
+}
+
+const tinypool = new Tinypool({
+ filename: './workers/tinypool/function-to-bench-worker.js',
+ minThreads: size,
+ maxThreads: size * 3,
+ idleTimeout: 60000 // this is the same as poolifier default
+})
+
+/**
+ *
+ */
+async function run () {
+ const promises = []
+ for (let i = 0; i < iterations; i++) {
+ promises.push(tinypool.run(data))
+ }
+ await Promise.all(promises)
+ // eslint-disable-next-line n/no-process-exit
+ process.exit()
+}
+
+run()
--- /dev/null
+// IMPORT LIBRARIES
+import Tinypool from 'tinypool'
+// FINISH IMPORT LIBRARIES
+const size = parseInt(process.env.POOL_SIZE)
+const iterations = parseInt(process.env.NUM_ITERATIONS)
+const data = {
+ test: 'MYBENCH',
+ taskType: process.env.TASK_TYPE,
+ taskSize: parseInt(process.env.TASK_SIZE)
+}
+
+const tinypool = new Tinypool({
+ filename: './workers/tinypool/function-to-bench-worker.js',
+ minThreads: size,
+ idleTimeout: 60000 // this is the same as poolifier default
+})
+
+/**
+ *
+ */
+async function run () {
+ const promises = []
+ for (let i = 0; i < iterations; i++) {
+ promises.push(tinypool.run(data))
+ }
+ await Promise.all(promises)
+ // eslint-disable-next-line n/no-process-exit
+ process.exit()
+}
+
+run()
'node fixed-poolifier.js' \
'node dynamic-piscina.js' \
'node fixed-piscina.js' \
+ 'node fixed-tinypool.mjs' \
+ 'node dynamic-tinypool.mjs' \
'node dynamic-workerpool.js' \
'node fixed-workerpool.js' \
'node dynamic-suchmokuo-node-worker-threads-pool.js' \
"poolifier": "2.6.2",
"threads": "1.7.0",
"threadwork": "0.6.0",
+ "tinypool": "0.5.0",
"worker-nodes": "2.5.0",
"workerpool": "6.4.0"
}
threadwork:
specifier: 0.6.0
version: 0.6.0
+ tinypool:
+ specifier: 0.5.0
+ version: 0.5.0
worker-nodes:
specifier: 2.5.0
version: 2.5.0
dev: false
optional: true
+ /tinypool@0.5.0:
+ resolution: {integrity: sha512-paHQtnrlS1QZYKF/GnLoOM/DN9fqaGOFbCbxzAhwniySnzl9Ebk8w73/dd34DAhe/obUbPAOldTyYXQZxnPBPQ==}
+ engines: {node: '>=14.0.0'}
+ dev: false
+
/worker-nodes@2.5.0:
resolution: {integrity: sha512-0hPZfN21PkMMeljxvFa2+MqOAItvwWnQYMUG6HGhM0X1rTlXPAgVFY+IH4UQC/TmSi/3qMIDdrxArRR8dEdQcQ==}
engines: {node: '>=11.7.0'}
--- /dev/null
+'use strict'
+const functionToBench = require('../../functions/function-to-bench')
+module.exports = functionToBench