Commit | Line | Data |
---|---|---|
6dc67cda | 1 | const FixedThreadPool = require('./fixed') |
c2dbbe2b | 2 | let resolved = 0 |
6dc67cda | 3 | |
3e460d6d | 4 | const pool = new FixedThreadPool(10) |
5 | ||
6 | const start = Date.now() | |
7 | const iterations = 100000 | |
8 | ||
c2dbbe2b | 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++ | |
3e460d6d | 16 | if (resolved === iterations) { |
17 | console.log('Time take is ' + (Date.now() - start)) | |
c2dbbe2b | 18 | } |
3e460d6d | 19 | }) |
6dc67cda | 20 | } |