Performance improvement with round robin algorithm
[poolifier.git] / proof.js
index daf55240418fffabb96901d5c2eab79403ca830a..b62e5ba5b9cc15af8cbf05dd1bc1f7a0697b26f9 100644 (file)
--- a/proof.js
+++ b/proof.js
@@ -1,9 +1,11 @@
 const FixedThreadPool = require('./fixed')
 let resolved = 0
 
-const pool = new FixedThreadPool(100)
-let start = Date.now()
-const iterations = 5000
+const pool = new FixedThreadPool(10)
+
+const start = Date.now()
+const iterations = 100000
+
 for (let i = 0; i <= iterations; i++) {
   const o = {
     a: i
@@ -11,8 +13,8 @@ for (let i = 0; i <= iterations; i++) {
   pool.execute(JSON.stringify, o).then(res => {
     console.log(res)
     resolved++
-    if(resolved === iterations) {
-         console.log('Time take is ' + (Date.now() - start))
+    if (resolved === iterations) {
+      console.log('Time take is ' + (Date.now() - start))
     }
-  } )
+  })
 }