summaryrefslogtreecommitdiff
path: root/deps/node/benchmark/child_process
diff options
context:
space:
mode:
Diffstat (limited to 'deps/node/benchmark/child_process')
-rw-r--r--deps/node/benchmark/child_process/child-process-exec-stdout.js40
-rw-r--r--deps/node/benchmark/child_process/child-process-params.js142
-rw-r--r--deps/node/benchmark/child_process/child-process-read-ipc.js37
-rw-r--r--deps/node/benchmark/child_process/child-process-read.js42
-rw-r--r--deps/node/benchmark/child_process/spawn-echo.js24
5 files changed, 0 insertions, 285 deletions
diff --git a/deps/node/benchmark/child_process/child-process-exec-stdout.js b/deps/node/benchmark/child_process/child-process-exec-stdout.js
deleted file mode 100644
index a1dc4aa0..00000000
--- a/deps/node/benchmark/child_process/child-process-exec-stdout.js
+++ /dev/null
@@ -1,40 +0,0 @@
-'use strict';
-const common = require('../common.js');
-const { exec, execSync } = require('child_process');
-const isWindows = process.platform === 'win32';
-
-const messagesLength = [64, 256, 1024, 4096];
-// Windows does not support command lines longer than 8191 characters
-if (!isWindows) messagesLength.push(32768);
-
-const bench = common.createBenchmark(childProcessExecStdout, {
- len: messagesLength,
- dur: [5]
-});
-
-function childProcessExecStdout({ dur, len }) {
- bench.start();
-
- const maxDuration = dur * 1000;
- const cmd = `yes "${'.'.repeat(len)}"`;
- const child = exec(cmd, { 'stdio': ['ignore', 'pipe', 'ignore'] });
-
- var bytes = 0;
- child.stdout.on('data', (msg) => {
- bytes += msg.length;
- });
-
- setTimeout(() => {
- bench.end(bytes);
- if (isWindows) {
- // Sometimes there's a yes.exe process left hanging around on Windows.
- try {
- execSync(`taskkill /f /t /pid ${child.pid}`);
- } catch {
- // This is a best effort kill. stderr is piped to parent for tracing.
- }
- } else {
- child.kill();
- }
- }, maxDuration);
-}
diff --git a/deps/node/benchmark/child_process/child-process-params.js b/deps/node/benchmark/child_process/child-process-params.js
deleted file mode 100644
index df930395..00000000
--- a/deps/node/benchmark/child_process/child-process-params.js
+++ /dev/null
@@ -1,142 +0,0 @@
-'use strict';
-
-const common = require('../common.js');
-const cp = require('child_process');
-
-const command = 'echo';
-const args = ['hello'];
-const options = {};
-const cb = () => {};
-
-const configs = {
- n: [1e3],
- methodName: [
- 'exec', 'execSync',
- 'execFile', 'execFileSync',
- 'spawn', 'spawnSync',
- ],
- params: [1, 2, 3, 4],
-};
-
-const bench = common.createBenchmark(main, configs);
-
-function main({ n, methodName, params }) {
- const method = cp[methodName];
-
- switch (methodName) {
- case 'exec':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command).kill();
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, options).kill();
- bench.end(n);
- break;
- case 3:
- bench.start();
- for (let i = 0; i < n; i++) method(command, options, cb).kill();
- bench.end(n);
- break;
- }
- break;
- case 'execSync':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command);
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, options);
- bench.end(n);
- break;
- }
- break;
- case 'execFile':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command).kill();
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args).kill();
- bench.end(n);
- break;
- case 3:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args, options).kill();
- bench.end(n);
- break;
- case 4:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args, options, cb).kill();
- bench.end(n);
- break;
- }
- break;
- case 'execFileSync':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command);
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args);
- bench.end(n);
- break;
- case 3:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args, options);
- bench.end(n);
- break;
- }
- break;
- case 'spawn':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command).kill();
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args).kill();
- bench.end(n);
- break;
- case 3:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args, options).kill();
- bench.end(n);
- break;
- }
- break;
- case 'spawnSync':
- switch (params) {
- case 1:
- bench.start();
- for (let i = 0; i < n; i++) method(command);
- bench.end(n);
- break;
- case 2:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args);
- bench.end(n);
- break;
- case 3:
- bench.start();
- for (let i = 0; i < n; i++) method(command, args, options);
- bench.end(n);
- break;
- }
- break;
- }
-}
diff --git a/deps/node/benchmark/child_process/child-process-read-ipc.js b/deps/node/benchmark/child_process/child-process-read-ipc.js
deleted file mode 100644
index a9e9cdf7..00000000
--- a/deps/node/benchmark/child_process/child-process-read-ipc.js
+++ /dev/null
@@ -1,37 +0,0 @@
-'use strict';
-if (process.argv[2] === 'child') {
- const len = +process.argv[3];
- const msg = '.'.repeat(len);
- const send = () => {
- while (process.send(msg));
- // Wait: backlog of unsent messages exceeds threshold
- setImmediate(send);
- };
- send();
-} else {
- const common = require('../common.js');
- const bench = common.createBenchmark(main, {
- len: [
- 64, 256, 1024, 4096, 16384, 65536,
- 65536 << 4, 65536 << 8,
- ],
- dur: [5]
- });
- const spawn = require('child_process').spawn;
-
- function main({ dur, len }) {
- bench.start();
-
- const options = { 'stdio': ['ignore', 1, 2, 'ipc'] };
- const child = spawn(process.argv[0],
- [process.argv[1], 'child', len], options);
-
- var bytes = 0;
- child.on('message', (msg) => { bytes += msg.length; });
-
- setTimeout(() => {
- child.kill();
- bench.end(bytes);
- }, dur * 1000);
- }
-}
diff --git a/deps/node/benchmark/child_process/child-process-read.js b/deps/node/benchmark/child_process/child-process-read.js
deleted file mode 100644
index 3c014411..00000000
--- a/deps/node/benchmark/child_process/child-process-read.js
+++ /dev/null
@@ -1,42 +0,0 @@
-'use strict';
-const common = require('../common.js');
-
-// This benchmark uses `yes` to a create noisy child_processes with varying
-// output message lengths, and tries to read 8GB of output
-
-const os = require('os');
-const child_process = require('child_process');
-
-const messagesLength = [64, 256, 1024, 4096];
-// Windows does not support that long arguments
-if (os.platform() !== 'win32')
- messagesLength.push(32768);
-
-const bench = common.createBenchmark(main, {
- len: messagesLength,
- dur: [5]
-});
-
-function main({ dur, len }) {
- bench.start();
-
- const msg = `"${'.'.repeat(len)}"`;
- const options = { 'stdio': ['ignore', 'pipe', 'ignore'] };
- const child = child_process.spawn('yes', [msg], options);
-
- var bytes = 0;
- child.stdout.on('data', (msg) => {
- bytes += msg.length;
- });
-
- setTimeout(() => {
- if (process.platform === 'win32') {
- // Sometimes there's a yes.exe process left hanging around on Windows...
- child_process.execSync(`taskkill /f /t /pid ${child.pid}`);
- } else {
- child.kill();
- }
- const gbits = (bytes * 8) / (1024 * 1024 * 1024);
- bench.end(gbits);
- }, dur * 1000);
-}
diff --git a/deps/node/benchmark/child_process/spawn-echo.js b/deps/node/benchmark/child_process/spawn-echo.js
deleted file mode 100644
index 8f5c80cd..00000000
--- a/deps/node/benchmark/child_process/spawn-echo.js
+++ /dev/null
@@ -1,24 +0,0 @@
-'use strict';
-const common = require('../common.js');
-const bench = common.createBenchmark(main, {
- n: [1000]
-});
-
-const spawn = require('child_process').spawn;
-function main({ n }) {
- bench.start();
- go(n, n);
-}
-
-function go(n, left) {
- if (--left === 0)
- return bench.end(n);
-
- const child = spawn('echo', ['hello']);
- child.on('exit', (code) => {
- if (code)
- process.exit(code);
- else
- go(n, left);
- });
-}