docs: update benchmarks vs. external pools
[poolifier.git] / benchmarks / versus-external-pools / fixed-tinypool.mjs
index 223c0f005837673d4f69a4d468c1938a67d929a6..07b3abe84a2cd258c26e2d4b3bc9f85bfd4f96ee 100644 (file)
@@ -10,22 +10,20 @@ const data = {
 }
 
 const tinypool = new Tinypool({
-  filename: './workers/tinypool/function-to-bench-worker.js',
+  filename: './workers/tinypool/function-to-bench-worker.mjs',
   minThreads: size,
+  maxThreads: size,
   idleTimeout: 60000 // this is the same as poolifier default
 })
 
-/**
- *
- */
 async function run () {
-  const promises = []
+  const promises = new Set()
   for (let i = 0; i < iterations; i++) {
-    promises.push(tinypool.run(data))
+    promises.add(tinypool.run(data))
   }
   await Promise.all(promises)
   // eslint-disable-next-line n/no-process-exit
   process.exit()
 }
 
-run()
+await run()