X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=proof.js;h=afa3a28ddb2bccd391ba562a64e0284eae157c4f;hb=27006a3d7cb579b1cddd70e32ebaaab1efff9555;hp=9f127e08db14933b15a6d01fe53513581464dc6d;hpb=6dc67cda007c824bc7af069ed25c3c88e8b6ed96;p=poolifier.git diff --git a/proof.js b/proof.js index 9f127e08..afa3a28d 100644 --- a/proof.js +++ b/proof.js @@ -1,7 +1,29 @@ const FixedThreadPool = require('./fixed') +let resolved = 0 +const pool = new FixedThreadPool(3, './yourWorker.js') -const o = { - a: 'asdfsadfafdgmnsdfmnbgsdfgbsdfmnbgsdfmnbgsmd,fbgsmndfbg' +async function proof () { + const o = { + a: 123 + } + const res = await pool.execute(o) + // console.log('Here we are') + console.log('I am logging the result ' + res) +} + +// proof() + +const start = Date.now() +const iterations = 50000 +for (let i = 0; i <= iterations; i++) { + const o = { + a: i + } + pool.execute(o).then(res => { + console.log(res) + resolved++ + if (resolved === iterations) { + console.log('Time take is ' + (Date.now() - start)) + } + }) } -const pool = new FixedThreadPool(3) -pool.execute(JSON.stringify, o).then(res => console.log(res))