From 73cda44834b69b6120f256d40351a504fb86c1ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 17 Oct 2022 00:15:04 +0200 Subject: [PATCH] Run benchmarks versus latest external pool libraries MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Close #594 Signed-off-by: Jérôme Benoit --- CHANGELOG.md | 7 +- benchmarks/README.md | 1 - .../versus-external-pools/BENCH-100000.md | 22 +-- .../versus-external-pools/dynamic-piscina.js | 2 +- .../versus-external-pools/fixed-piscina.js | 2 +- .../versus-external-pools/fixed-threadwork.js | 8 +- .../fixed-worker-threads-pool.js | 37 ----- .../hyperfine_benchmarks.sh | 3 +- .../versus-external-pools/package-lock.json | 152 ++++++------------ benchmarks/versus-external-pools/package.json | 11 +- .../versus-external-pools/pool-threadwork.js | 9 ++ benchmarks/versus-external-pools/threadjs.js | 2 +- .../function-to-bench-worker.js | 4 - 13 files changed, 81 insertions(+), 179 deletions(-) delete mode 100644 benchmarks/versus-external-pools/fixed-worker-threads-pool.js create mode 100644 benchmarks/versus-external-pools/pool-threadwork.js delete mode 100644 benchmarks/versus-external-pools/workers/worker-threads-pool/function-to-bench-worker.js diff --git a/CHANGELOG.md b/CHANGELOG.md index 39b86b2b..5a6e289e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Fully automate release process with release-it. + ### Changed -- Optimize fair share task scheduling algorithm. +- Optimize fair share task scheduling algorithm implementation. +- Update benchmarks versus external pools results. ## [2.3.3] - 2022-15-10 diff --git a/benchmarks/README.md b/benchmarks/README.md index 92357060..f8d0bbdd 100644 --- a/benchmarks/README.md +++ b/benchmarks/README.md @@ -19,7 +19,6 @@ External pools with which we compared the poolifier results: - [workerpool](https://github.com/josdejong/workerpool) - [threadwork](https://github.com/kevlened/threadwork) - [microjob](https://github.com/wilk/microjob) - Those are our results: diff --git a/benchmarks/versus-external-pools/BENCH-100000.md b/benchmarks/versus-external-pools/BENCH-100000.md index 0bb2f472..6c2aae9c 100644 --- a/benchmarks/versus-external-pools/BENCH-100000.md +++ b/benchmarks/versus-external-pools/BENCH-100000.md @@ -1,13 +1,13 @@ | Command | Mean [s] | Min [s] | Max [s] | Relative | | :--------------------------------------------------- | -------------: | ------: | ------: | ----------: | -| `node dynamic-piscina.js` | 18.364 ± 0.203 | 18.050 | 18.737 | 1.07 ± 0.02 | -| `node fixed-piscina.js` | 18.222 ± 0.519 | 17.529 | 19.164 | 1.06 ± 0.03 | -| `node dynamic-poolifier.js` | 17.135 ± 0.256 | 16.926 | 17.755 | 1.00 | -| `node fixed-poolifier.js` | 17.947 ± 0.489 | 17.567 | 18.951 | 1.05 ± 0.03 | -| `node dynamic-suchmokuo-node-worker-threads-pool.js` | 25.460 ± 0.453 | 25.124 | 26.617 | 1.49 ± 0.03 | -| `node static-suchmokuo-node-worker-threads-pool.js` | 18.993 ± 0.714 | 18.388 | 20.610 | 1.11 ± 0.04 | -| `node threadjs.js` | 80.939 ± 3.548 | 76.881 | 88.363 | 4.72 ± 0.22 | -| `node dynamic-workerpool.js` | 19.292 ± 0.110 | 19.109 | 19.480 | 1.13 ± 0.02 | -| `node fixed-workerpool.js` | 19.684 ± 0.636 | 19.212 | 21.049 | 1.15 ± 0.04 | -| `node fixed-threadwork.js` | 30.023 ± 0.362 | 29.524 | 30.727 | 1.75 ± 0.03 | -| `node fixed-microjob.js` | 32.526 ± 0.649 | 31.696 | 33.687 | 1.90 ± 0.05 | +| `node dynamic-piscina.js` | 27.917 ± 3.550 | 23.332 | 32.602 | 1.24 ± 0.17 | +| `node fixed-piscina.js` | 24.073 ± 0.603 | 23.245 | 24.980 | 1.07 ± 0.06 | +| `node dynamic-poolifier.js` | 22.571 ± 1.049 | 21.715 | 25.146 | 1.00 | +| `node fixed-poolifier.js` | 23.344 ± 0.508 | 22.659 | 24.247 | 1.03 ± 0.05 | +| `node dynamic-suchmokuo-node-worker-threads-pool.js` | 33.512 ± 1.607 | 32.231 | 37.384 | 1.48 ± 0.10 | +| `node static-suchmokuo-node-worker-threads-pool.js` | 24.475 ± 0.578 | 23.780 | 25.335 | 1.08 ± 0.06 | +| `node threadjs.js` | 92.927 ± 5.314 | 84.503 | 102.706 | 4.12 ± 0.30 | +| `node dynamic-workerpool.js` | 27.519 ± 0.717 | 26.510 | 29.063 | 1.22 ± 0.06 | +| `node fixed-workerpool.js` | 25.787 ± 0.620 | 25.066 | 26.622 | 1.14 ± 0.06 | +| `node fixed-threadwork.js` | 24.481 ± 0.505 | 23.711 | 25.274 | 1.08 ± 0.06 | +| `node fixed-microjob.js` | 41.766 ± 1.275 | 40.694 | 45.133 | 1.85 ± 0.10 | diff --git a/benchmarks/versus-external-pools/dynamic-piscina.js b/benchmarks/versus-external-pools/dynamic-piscina.js index 83190d43..61681dab 100644 --- a/benchmarks/versus-external-pools/dynamic-piscina.js +++ b/benchmarks/versus-external-pools/dynamic-piscina.js @@ -18,7 +18,7 @@ const piscina = new Piscina({ async function run () { const promises = [] for (let i = 0; i < iterations; i++) { - promises.push(piscina.runTask(data)) + promises.push(piscina.run(data)) } await Promise.all(promises) process.exit() diff --git a/benchmarks/versus-external-pools/fixed-piscina.js b/benchmarks/versus-external-pools/fixed-piscina.js index c89a951d..861fe4f6 100644 --- a/benchmarks/versus-external-pools/fixed-piscina.js +++ b/benchmarks/versus-external-pools/fixed-piscina.js @@ -17,7 +17,7 @@ const piscina = new Piscina({ async function run () { const promises = [] for (let i = 0; i < iterations; i++) { - promises.push(piscina.runTask(data)) + promises.push(piscina.run(data)) } await Promise.all(promises) process.exit() diff --git a/benchmarks/versus-external-pools/fixed-threadwork.js b/benchmarks/versus-external-pools/fixed-threadwork.js index fcc370ff..eb316b53 100644 --- a/benchmarks/versus-external-pools/fixed-threadwork.js +++ b/benchmarks/versus-external-pools/fixed-threadwork.js @@ -1,18 +1,12 @@ // IMPORT LIBRARIES -const { ThreadPool } = require('threadwork') +const threadPool = require('./pool-threadwork') // FINISH IMPORT LIBRARIES -// IMPORT FUNCTION TO BENCH -const functionToBench = require('./functions/function-to-bench') -// FINISH IMPORT FUNCTION TO BENCH -const size = Number(process.env.POOL_SIZE) const iterations = Number(process.env.NUM_ITERATIONS) const data = { test: 'MYBENCH', taskType: process.env['TASK_TYPE'] } -const threadPool = new ThreadPool({ task: functionToBench, size: size }) - async function run () { const promises = [] for (let i = 0; i < iterations; i++) { diff --git a/benchmarks/versus-external-pools/fixed-worker-threads-pool.js b/benchmarks/versus-external-pools/fixed-worker-threads-pool.js deleted file mode 100644 index b4d9eced..00000000 --- a/benchmarks/versus-external-pools/fixed-worker-threads-pool.js +++ /dev/null @@ -1,37 +0,0 @@ -// IMPORT LIBRARIES -const Pool = require('worker-threads-pool') -// FINISH IMPORT LIBRARIES -const size = Number(process.env.POOL_SIZE) -const iterations = Number(process.env.NUM_ITERATIONS) -const data = { - test: 'MYBENCH', - taskType: process.env['TASK_TYPE'] -} - -const pool = new Pool({ max: size }) - -async function poolAcquireAsync () { - return new Promise((resolve, reject) => { - pool.acquire( - './workers/worker-threads-pool/function-to-bench-worker.js', - { - workerData: data - }, - err => { - if (err) reject(err) - resolve() - } - ) - }) -} - -async function run () { - const promises = [] - for (let i = 0; i < iterations; i++) { - promises.push(poolAcquireAsync()) - } - await Promise.all(promises) - process.exit() -} - -run() diff --git a/benchmarks/versus-external-pools/hyperfine_benchmarks.sh b/benchmarks/versus-external-pools/hyperfine_benchmarks.sh index 7ab3bf3f..1ac1beda 100755 --- a/benchmarks/versus-external-pools/hyperfine_benchmarks.sh +++ b/benchmarks/versus-external-pools/hyperfine_benchmarks.sh @@ -12,7 +12,6 @@ hyperfine --export-markdown BENCH-100000.md --min-runs 10 \ 'node dynamic-workerpool.js' \ 'node fixed-workerpool.js' \ 'node fixed-threadwork.js' \ - 'node fixed-microjob.js' \ - # 'node fixed-worker-threads-pool.js' + 'node fixed-microjob.js' diff --git a/benchmarks/versus-external-pools/package-lock.json b/benchmarks/versus-external-pools/package-lock.json index 1e9840f8..0dce8f65 100644 --- a/benchmarks/versus-external-pools/package-lock.json +++ b/benchmarks/versus-external-pools/package-lock.json @@ -9,13 +9,12 @@ "version": "1.0.0-internal", "dependencies": { "microjob": "0.7.0", - "node-worker-threads-pool": "1.4.3", - "piscina": "3.0.0", - "poolifier": "2.0.1", - "threads": "1.6.4", + "node-worker-threads-pool": "1.5.1", + "piscina": "3.2.0", + "poolifier": "2.3.3", + "threads": "1.7.0", "threadwork": "0.6.0", - "worker-threads-pool": "2.0.0", - "workerpool": "6.1.4" + "workerpool": "6.2.1" } }, "node_modules/@assemblyscript/loader": { @@ -23,14 +22,6 @@ "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz", "integrity": "sha512-H71nDOOL8Y7kWRLqf6Sums+01Q5msqBW2KhDUTemh1tvY04eSkSXrK0uj/4mmY0Xr16/3zyZmsrxN7CKuRbNRg==" }, - "node_modules/after-all": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/after-all/-/after-all-2.0.2.tgz", - "integrity": "sha1-IDACmO1glLTIXJjnyK1NymKPn3M=", - "dependencies": { - "once": "^1.3.0" - } - }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -189,22 +180,14 @@ } }, "node_modules/node-worker-threads-pool": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/node-worker-threads-pool/-/node-worker-threads-pool-1.4.3.tgz", - "integrity": "sha512-US55ZGzEDQY2oq8Bc33dFVNKGpx4KaCJqThMDomSsUeX8tMdp2eDjQ6OP0yFd1HTEuHuLqxXSTWC4eidEsbXlg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/node-worker-threads-pool/-/node-worker-threads-pool-1.5.1.tgz", + "integrity": "sha512-7TXAhpMm+jO4MfESxYLtMGSnJWv+itdNHMdaFmeZuPXxwFGU90mtEB42BciUULXOUAxYBfXILAuvrSG3rQZ7mw==" }, "node_modules/observable-fns": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.5.1.tgz", - "integrity": "sha512-wf7g4Jpo1Wt2KIqZKLGeiuLOEMqpaOZ5gJn7DmSdqXgTdxRwSdBhWegQQpPteQ2gZvzCKqNNpwb853wcpA0j7A==" - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dependencies": { - "wrappy": "1" - } + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.6.1.tgz", + "integrity": "sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==" }, "node_modules/p-limit": { "version": "3.1.0", @@ -248,9 +231,9 @@ } }, "node_modules/piscina": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/piscina/-/piscina-3.0.0.tgz", - "integrity": "sha512-ye56YiBCK3loPGsagK/Sf/aeuCPAkvZIJDGQnv+SSOQUz1Od5cUsDeirQBB0cxFkXCY6FDsk36Z9xX1D2Zb8Zw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/piscina/-/piscina-3.2.0.tgz", + "integrity": "sha512-yn/jMdHRw+q2ZJhFhyqsmANcbF6V2QwmD84c6xRau+QpQOmtrBCoRGdvTfeuFDYXB5W2m6MfLkjkvQa9lUSmIA==", "dependencies": { "eventemitter-asyncresource": "^1.0.0", "hdr-histogram-js": "^2.0.1", @@ -272,23 +255,23 @@ } }, "node_modules/poolifier": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.0.1.tgz", - "integrity": "sha512-klkLv35QVumXKrQj6Totvwqb0lw34j7mIsEm8uZXXHlcpVCvnhhgVFVyuZUOSNTjZnBCaiB0KcLos03cqj38CA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.3.3.tgz", + "integrity": "sha512-mxkMpqPMHtdGeJfBe7iXRkIlcXJNYNuCPCw0sLhch8k7sFGGk0pby5eToGVwBx6Yxc0o7aCR5JU1blnFLl8Igg==", "engines": { - "node": ">=12.11.0", - "npm": ">=6.0.0 <7" + "node": ">=16.0.0", + "npm": ">=8.0.0" } }, "node_modules/threads": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/threads/-/threads-1.6.4.tgz", - "integrity": "sha512-A+9MQFAUha9W8MjIPmrvETy98qVmZFr5Unox9D95y7kvz3fBpGiFS7JOZs07B2KvTHoRNI5MrGudRVeCmv4Alw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/threads/-/threads-1.7.0.tgz", + "integrity": "sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==", "dependencies": { "callsites": "^3.1.0", "debug": "^4.2.0", "is-observable": "^2.1.0", - "observable-fns": "^0.5.1" + "observable-fns": "^0.6.1" }, "funding": { "url": "https://github.com/andywer/threads.js?sponsor=1" @@ -318,26 +301,10 @@ "esm": "^3.2.25" } }, - "node_modules/worker-threads-pool": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/worker-threads-pool/-/worker-threads-pool-2.0.0.tgz", - "integrity": "sha512-5dtGbEucee6o5/kQgpyKIUoHGWf8488DP3ihZDJzDIVvH4V+NA6HdBl/I5ckI4yN1NwM68pdZDbrwac1M95mEA==", - "dependencies": { - "after-all": "^2.0.2" - }, - "engines": { - "node": ">=10.5.0" - } - }, "node_modules/workerpool": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.4.tgz", - "integrity": "sha512-jGWPzsUqzkow8HoAvqaPWTUPCrlPJaJ5tY8Iz7n1uCz3tTp6s3CDG0FF1NsX42WNlkRSW6Mr+CDZGnNoSsKa7g==" - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==" }, "node_modules/yocto-queue": { "version": "0.1.0", @@ -357,14 +324,6 @@ "resolved": "https://registry.npmjs.org/@assemblyscript/loader/-/loader-0.10.1.tgz", "integrity": "sha512-H71nDOOL8Y7kWRLqf6Sums+01Q5msqBW2KhDUTemh1tvY04eSkSXrK0uj/4mmY0Xr16/3zyZmsrxN7CKuRbNRg==" }, - "after-all": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/after-all/-/after-all-2.0.2.tgz", - "integrity": "sha1-IDACmO1glLTIXJjnyK1NymKPn3M=", - "requires": { - "once": "^1.3.0" - } - }, "base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -464,22 +423,14 @@ "optional": true }, "node-worker-threads-pool": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/node-worker-threads-pool/-/node-worker-threads-pool-1.4.3.tgz", - "integrity": "sha512-US55ZGzEDQY2oq8Bc33dFVNKGpx4KaCJqThMDomSsUeX8tMdp2eDjQ6OP0yFd1HTEuHuLqxXSTWC4eidEsbXlg==" + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/node-worker-threads-pool/-/node-worker-threads-pool-1.5.1.tgz", + "integrity": "sha512-7TXAhpMm+jO4MfESxYLtMGSnJWv+itdNHMdaFmeZuPXxwFGU90mtEB42BciUULXOUAxYBfXILAuvrSG3rQZ7mw==" }, "observable-fns": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.5.1.tgz", - "integrity": "sha512-wf7g4Jpo1Wt2KIqZKLGeiuLOEMqpaOZ5gJn7DmSdqXgTdxRwSdBhWegQQpPteQ2gZvzCKqNNpwb853wcpA0j7A==" - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "requires": { - "wrappy": "1" - } + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/observable-fns/-/observable-fns-0.6.1.tgz", + "integrity": "sha512-9gRK4+sRWzeN6AOewNBTLXir7Zl/i3GB6Yl26gK4flxz8BXVpD3kt8amREmWNb0mxYOGDotvE5a4N+PtGGKdkg==" }, "p-limit": { "version": "3.1.0", @@ -508,9 +459,9 @@ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" }, "piscina": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/piscina/-/piscina-3.0.0.tgz", - "integrity": "sha512-ye56YiBCK3loPGsagK/Sf/aeuCPAkvZIJDGQnv+SSOQUz1Od5cUsDeirQBB0cxFkXCY6FDsk36Z9xX1D2Zb8Zw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/piscina/-/piscina-3.2.0.tgz", + "integrity": "sha512-yn/jMdHRw+q2ZJhFhyqsmANcbF6V2QwmD84c6xRau+QpQOmtrBCoRGdvTfeuFDYXB5W2m6MfLkjkvQa9lUSmIA==", "requires": { "eventemitter-asyncresource": "^1.0.0", "hdr-histogram-js": "^2.0.1", @@ -527,19 +478,19 @@ } }, "poolifier": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.0.1.tgz", - "integrity": "sha512-klkLv35QVumXKrQj6Totvwqb0lw34j7mIsEm8uZXXHlcpVCvnhhgVFVyuZUOSNTjZnBCaiB0KcLos03cqj38CA==" + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/poolifier/-/poolifier-2.3.3.tgz", + "integrity": "sha512-mxkMpqPMHtdGeJfBe7iXRkIlcXJNYNuCPCw0sLhch8k7sFGGk0pby5eToGVwBx6Yxc0o7aCR5JU1blnFLl8Igg==" }, "threads": { - "version": "1.6.4", - "resolved": "https://registry.npmjs.org/threads/-/threads-1.6.4.tgz", - "integrity": "sha512-A+9MQFAUha9W8MjIPmrvETy98qVmZFr5Unox9D95y7kvz3fBpGiFS7JOZs07B2KvTHoRNI5MrGudRVeCmv4Alw==", + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/threads/-/threads-1.7.0.tgz", + "integrity": "sha512-Mx5NBSHX3sQYR6iI9VYbgHKBLisyB+xROCBGjjWm1O9wb9vfLxdaGtmT/KCjUqMsSNW6nERzCW3T6H43LqjDZQ==", "requires": { "callsites": "^3.1.0", "debug": "^4.2.0", "is-observable": "^2.1.0", - "observable-fns": "^0.5.1", + "observable-fns": "^0.6.1", "tiny-worker": ">= 2" } }, @@ -561,23 +512,10 @@ "esm": "^3.2.25" } }, - "worker-threads-pool": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/worker-threads-pool/-/worker-threads-pool-2.0.0.tgz", - "integrity": "sha512-5dtGbEucee6o5/kQgpyKIUoHGWf8488DP3ihZDJzDIVvH4V+NA6HdBl/I5ckI4yN1NwM68pdZDbrwac1M95mEA==", - "requires": { - "after-all": "^2.0.2" - } - }, "workerpool": { - "version": "6.1.4", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.4.tgz", - "integrity": "sha512-jGWPzsUqzkow8HoAvqaPWTUPCrlPJaJ5tY8Iz7n1uCz3tTp6s3CDG0FF1NsX42WNlkRSW6Mr+CDZGnNoSsKa7g==" - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.1.tgz", + "integrity": "sha512-ILEIE97kDZvF9Wb9f6h5aXK4swSlKGUcOEGiIYb2OOu/IrDU9iwj0fD//SsA6E5ibwJxpEvhullJY4Sl4GcpAw==" }, "yocto-queue": { "version": "0.1.0", diff --git a/benchmarks/versus-external-pools/package.json b/benchmarks/versus-external-pools/package.json index a3b7f0ef..fe74923a 100644 --- a/benchmarks/versus-external-pools/package.json +++ b/benchmarks/versus-external-pools/package.json @@ -10,12 +10,11 @@ }, "dependencies": { "microjob": "0.7.0", - "node-worker-threads-pool": "1.4.3", - "piscina": "3.0.0", - "poolifier": "2.0.1", - "threads": "1.6.4", + "node-worker-threads-pool": "1.5.1", + "piscina": "3.2.0", + "poolifier": "2.3.3", + "threads": "1.7.0", "threadwork": "0.6.0", - "worker-threads-pool": "2.0.0", - "workerpool": "6.1.4" + "workerpool": "6.2.1" } } diff --git a/benchmarks/versus-external-pools/pool-threadwork.js b/benchmarks/versus-external-pools/pool-threadwork.js new file mode 100644 index 00000000..5e5e04e3 --- /dev/null +++ b/benchmarks/versus-external-pools/pool-threadwork.js @@ -0,0 +1,9 @@ +// IMPORT LIBRARIES +const { ThreadPool } = require('threadwork') +// FINISH IMPORT LIBRARIES +// IMPORT FUNCTION TO BENCH +const functionToBench = require('./functions/function-to-bench') +// FINISH IMPORT FUNCTION TO BENCH +const size = Number(process.env.POOL_SIZE) + +module.exports = new ThreadPool({ task: functionToBench, size: size }) diff --git a/benchmarks/versus-external-pools/threadjs.js b/benchmarks/versus-external-pools/threadjs.js index 2cc96d57..18a01cfd 100644 --- a/benchmarks/versus-external-pools/threadjs.js +++ b/benchmarks/versus-external-pools/threadjs.js @@ -1,5 +1,5 @@ // IMPORT LIBRARIES -const { spawn, Thread, Worker } = require('threads') +const { spawn, Worker } = require('threads') // FINISH IMPORT LIBRARIES const size = Number(process.env.POOL_SIZE) const iterations = Number(process.env.NUM_ITERATIONS) diff --git a/benchmarks/versus-external-pools/workers/worker-threads-pool/function-to-bench-worker.js b/benchmarks/versus-external-pools/workers/worker-threads-pool/function-to-bench-worker.js deleted file mode 100644 index 202eeb3d..00000000 --- a/benchmarks/versus-external-pools/workers/worker-threads-pool/function-to-bench-worker.js +++ /dev/null @@ -1,4 +0,0 @@ -'use strict' -const { workerData } = require('worker_threads') -const functionToBench = require('../../functions/function-to-bench') -functionToBench(workerData) -- 2.34.1