Performance improvement with round robin algorithm
[poolifier.git] / proof.js
1 const FixedThreadPool = require('./fixed')
2 let resolved = 0
3
4 const pool = new FixedThreadPool(10)
5
6 const start = Date.now()
7 const iterations = 100000
8
9 for (let i = 0; i <= iterations; i++) {
10 const o = {
11 a: i
12 }
13 pool.execute(JSON.stringify, o).then(res => {
14 console.log(res)
15 resolved++
16 if (resolved === iterations) {
17 console.log('Time take is ' + (Date.now() - start))
18 }
19 })
20 }