From d1005fb39b9c14ea9126b3e8341392c871569f64 Mon Sep 17 00:00:00 2001 From: Ali Hassan Date: Thu, 11 Apr 2024 00:41:37 +0500 Subject: [PATCH 1/2] benchmark: add ipc support to spawn stdio config Enabled inter-process communication (ipc) in the stdio configuration of the spawn function within the benchmark subsystem. This change allows for improved data exchange between parent and benchmarked child processes, addressing limitations in performance testing scenarios. Fixes: https://github.com/nodejs/node/issues/52233 Refs: https://github.com/nodejs/performance/pull/161 --- benchmark/compare.js | 2 +- benchmark/run.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/benchmark/compare.js b/benchmark/compare.js index 1efff9e85c072f..0c53d90def371b 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -83,7 +83,7 @@ if (showProgress) { const spawnArgs = ['-c', cpuCore, cli.optional[job.binary], resolvedPath, ...cli.optional.set]; child = spawn('taskset', spawnArgs, { env: process.env, - stdio: ['inherit', 'pipe', 'pipe'], + stdio: ['inherit', 'pipe', 'pipe', 'ipc'], }); child.stdout.pipe(process.stdout); diff --git a/benchmark/run.js b/benchmark/run.js index 11f95d8e71f035..ff2d41e6056aa2 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -54,7 +54,7 @@ if (format === 'csv') { let child; if (cpuCore !== null) { child = spawn('taskset', ['-c', cpuCore, 'node', scriptPath, ...args], { - stdio: ['inherit', 'pipe', 'pipe'], + stdio: ['inherit', 'pipe', 'pipe', 'ipc'], }); child.stdout.pipe(process.stdout); From 001eb87e99b319f212d946ec9de87b7ad3562915 Mon Sep 17 00:00:00 2001 From: Ali Hassan Date: Thu, 11 Apr 2024 01:35:58 +0500 Subject: [PATCH 2/2] benchmark: inherit stdio/stderr instead of pipe --- benchmark/compare.js | 5 +---- benchmark/run.js | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/benchmark/compare.js b/benchmark/compare.js index 0c53d90def371b..ad3084db390414 100644 --- a/benchmark/compare.js +++ b/benchmark/compare.js @@ -83,11 +83,8 @@ if (showProgress) { const spawnArgs = ['-c', cpuCore, cli.optional[job.binary], resolvedPath, ...cli.optional.set]; child = spawn('taskset', spawnArgs, { env: process.env, - stdio: ['inherit', 'pipe', 'pipe', 'ipc'], + stdio: ['inherit', 'inherit', 'inherit', 'ipc'], }); - - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); } else { child = fork(resolvedPath, cli.optional.set, { execPath: cli.optional[job.binary], diff --git a/benchmark/run.js b/benchmark/run.js index ff2d41e6056aa2..6a61df71221710 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -54,11 +54,8 @@ if (format === 'csv') { let child; if (cpuCore !== null) { child = spawn('taskset', ['-c', cpuCore, 'node', scriptPath, ...args], { - stdio: ['inherit', 'pipe', 'pipe', 'ipc'], + stdio: ['inherit', 'inherit', 'inherit', 'ipc'], }); - - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); } else { child = fork( scriptPath,