X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=proof.js;h=afa3a28ddb2bccd391ba562a64e0284eae157c4f;hb=27006a3d7cb579b1cddd70e32ebaaab1efff9555;hp=daf55240418fffabb96901d5c2eab79403ca830a;hpb=c2dbbe2bf4c29241fefc8145cb9fa8f45e8fda6a;p=poolifier.git diff --git a/proof.js b/proof.js index daf55240..afa3a28d 100644 --- a/proof.js +++ b/proof.js @@ -1,18 +1,29 @@ const FixedThreadPool = require('./fixed') let resolved = 0 +const pool = new FixedThreadPool(3, './yourWorker.js') -const pool = new FixedThreadPool(100) -let start = Date.now() -const iterations = 5000 +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(JSON.stringify, o).then(res => { + pool.execute(o).then(res => { console.log(res) resolved++ - if(resolved === iterations) { - console.log('Time take is ' + (Date.now() - start)) + if (resolved === iterations) { + console.log('Time take is ' + (Date.now() - start)) } - } ) + }) }