refactor: convert benchmarks code to ESM
[poolifier.git] / benchmarks / versus-external-pools / threadjs.js
diff --git a/benchmarks/versus-external-pools/threadjs.js b/benchmarks/versus-external-pools/threadjs.js
deleted file mode 100644 (file)
index ee9178e..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-// IMPORT LIBRARIES
-const { spawn, Worker } = require('threads')
-// 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)
-}
-
-// Threads.js is not really a pool so we need to write few additional code
-const workers = []
-async function poolify () {
-  for (let i = 0; i < size; i++) {
-    const worker = await spawn(
-      new Worker('./workers/threadjs/function-to-bench-worker.js')
-    )
-    workers.push(worker)
-  }
-}
-
-async function run () {
-  await poolify()
-  const promises = []
-  for (let i = 0; i < iterations; i++) {
-    const worker = workers[i % size]
-    promises.push(worker.exposedFunction(data))
-  }
-  await Promise.all(promises)
-  // eslint-disable-next-line n/no-process-exit
-  process.exit()
-}
-
-run()