From e1c56ec3fd20f6c354387ce0f8a8a361aa3c7aa1 Mon Sep 17 00:00:00 2001 From: Deokjin Kim Date: Mon, 2 Jan 2023 13:15:37 +0900 Subject: [PATCH] benchmark,tools: use os.availableParallelism() Refs: https://github.com/nodejs/node/pull/45895 PR-URL: https://github.com/nodejs/node/pull/46003 Reviewed-By: Moshe Atlow Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Yagiz Nizipli --- benchmark/_http-benchmarkers.js | 2 +- tools/build-addons.mjs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/_http-benchmarkers.js b/benchmark/_http-benchmarkers.js index ec0e80a9e7edbe..e8c5ee7711ab33 100644 --- a/benchmark/_http-benchmarkers.js +++ b/benchmark/_http-benchmarkers.js @@ -65,7 +65,7 @@ class WrkBenchmarker { const args = [ '-d', duration, '-c', options.connections, - '-t', Math.min(options.connections, require('os').cpus().length || 8), + '-t', Math.min(options.connections, require('os').availableParallelism() || 8), `${scheme}://127.0.0.1:${options.port}${options.path}`, ]; for (const field in options.headers) { diff --git a/tools/build-addons.mjs b/tools/build-addons.mjs index b0ec02d8e90cba..a96c18435ddc03 100755 --- a/tools/build-addons.mjs +++ b/tools/build-addons.mjs @@ -11,7 +11,7 @@ import os from 'node:os'; const execFile = util.promisify(child_process.execFile); -const parallelization = +process.env.JOBS || os.cpus().length; +const parallelization = +process.env.JOBS || os.availableParallelism(); const nodeGyp = process.argv[2]; const directory = process.argv[3];