Performance improvement with round robin algorithm
[poolifier.git] / proof.js
CommitLineData
6dc67cda 1const FixedThreadPool = require('./fixed')
c2dbbe2b 2let resolved = 0
6dc67cda 3
3e460d6d 4const pool = new FixedThreadPool(10)
5
6const start = Date.now()
7const iterations = 100000
8
c2dbbe2b 9for (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++
3e460d6d 16 if (resolved === iterations) {
17 console.log('Time take is ' + (Date.now() - start))
c2dbbe2b 18 }
3e460d6d 19 })
6dc67cda 20}