A dynamic thread pool and a new worker implementation. Next step is to write some...
[poolifier.git] / proof.js
1 const FixedThreadPool = require('./lib/fixed')
2 const DynamicThreadPool = require('./lib/dynamic')
3 let resolved = 0
4 // const pool = new FixedThreadPool(15, './yourWorker.js')
5 const pool = new DynamicThreadPool(15, 1020, './yourWorker.js')
6
7 const start = Date.now()
8 const iterations = 1000
9 for (let i = 0; i <= iterations; i++) {
10 pool.execute({}).then(res => {
11 // console.log(res)
12 resolved++
13 if (resolved === iterations) {
14 console.log('Time take is ' + (Date.now() - start))
15 }
16 })
17 }