X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=benchmarks%2Fbench.js;h=0dde5055f466161ca6c9863ddb2ed4b4436b8859;hb=655291eecbcb2f9aba32f9045d658d4dbb110e4b;hp=d7b2f1a36c322f29b5745bcd527ccd159113a903;hpb=106744f7518d0f64ce85c4507157092083c2c4d4;p=poolifier.git diff --git a/benchmarks/bench.js b/benchmarks/bench.js index d7b2f1a3..0dde5055 100644 --- a/benchmarks/bench.js +++ b/benchmarks/bench.js @@ -2,12 +2,10 @@ const Benchmark = require('benchmark') const suite = new Benchmark.Suite() const FixedThreadPool = require('../lib/fixed') const DynamicThreadPool = require('../lib/dynamic') -const Pool = require('worker-threads-pool') const size = 30 const tasks = 1 // pools -const externalPool = new Pool({ max: size }) const fixedPool = new FixedThreadPool(size, './yourWorker.js', { maxTasks: 10000 }) const dynamicPool = new DynamicThreadPool(size / 2, size * 3, './yourWorker.js', { maxTasks: 10000 }) @@ -47,30 +45,6 @@ async function dynamicTest () { }) } -async function externalPoolTest () { - return new Promise((resolve, reject) => { - let executions = 0 - for (let i = 0; i <= tasks; i++) { - new Promise((resolve, reject) => { - externalPool.acquire('./externalWorker.js', { workerData: workerData }, (err, worker) => { - if (err) { - return reject(err) - } - worker.on('error', reject) - worker.on('message', res => { - executions++ - resolve(res) - }) - }) - }).then(res => { - if (tasks === executions) { - resolve('FINISH') - } - }) - } - }) -} - async function test () { // add tests suite.add('PioardiStaticPool', async function () { @@ -79,9 +53,6 @@ async function test () { .add('PioardiDynamicPool', async function () { await dynamicTest() }) - .add('ExternalPool', async function () { - await externalPoolTest() - }) // add listeners .on('cycle', function (event) { console.log(String(event.target))