diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2017-12-30 06:00:22 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-01-23 03:29:32 +0300 |
commit | d49580d8121c1ca75b53fbbc4445f68deb6207a4 (patch) | |
tree | 3a0102d410caa7300e83424132b74b2f3acbc5e5 /benchmark/child_process | |
parent | 8e3d7623a54123821ad731c63c8ea661ca5c84c8 (diff) |
benchmark: (child_process) use destructuring
PR-URL: https://github.com/nodejs/node/pull/18250
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'benchmark/child_process')
-rw-r--r-- | benchmark/child_process/child-process-exec-stdout.js | 6 | ||||
-rw-r--r-- | benchmark/child_process/child-process-params.js | 6 | ||||
-rw-r--r-- | benchmark/child_process/child-process-read-ipc.js | 6 | ||||
-rw-r--r-- | benchmark/child_process/child-process-read.js | 5 | ||||
-rw-r--r-- | benchmark/child_process/spawn-echo.js | 4 |
5 files changed, 7 insertions, 20 deletions
diff --git a/benchmark/child_process/child-process-exec-stdout.js b/benchmark/child_process/child-process-exec-stdout.js index 1e78d445f83..a891026b869 100644 --- a/benchmark/child_process/child-process-exec-stdout.js +++ b/benchmark/child_process/child-process-exec-stdout.js @@ -12,12 +12,10 @@ const bench = common.createBenchmark(childProcessExecStdout, { dur: [5] }); -function childProcessExecStdout(conf) { +function childProcessExecStdout({ dur, len }) { bench.start(); - const maxDuration = conf.dur * 1000; - const len = +conf.len; - + const maxDuration = dur * 1000; const cmd = `yes "${'.'.repeat(len)}"`; const child = exec(cmd, { 'stdio': ['ignore', 'pipe', 'ignore'] }); diff --git a/benchmark/child_process/child-process-params.js b/benchmark/child_process/child-process-params.js index 644b2136a0f..df930395b2a 100644 --- a/benchmark/child_process/child-process-params.js +++ b/benchmark/child_process/child-process-params.js @@ -20,11 +20,7 @@ const configs = { const bench = common.createBenchmark(main, configs); -function main(conf) { - const n = +conf.n; - const methodName = conf.methodName; - const params = +conf.params; - +function main({ n, methodName, params }) { const method = cp[methodName]; switch (methodName) { diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js index e6fb9b19c20..3971eb8b396 100644 --- a/benchmark/child_process/child-process-read-ipc.js +++ b/benchmark/child_process/child-process-read-ipc.js @@ -18,11 +18,9 @@ if (process.argv[2] === 'child') { dur: [5] }); const spawn = require('child_process').spawn; - function main(conf) { - bench.start(); - const dur = +conf.dur; - const len = +conf.len; + function main({ dur, len }) { + bench.start(); const options = { 'stdio': ['ignore', 1, 2, 'ipc'] }; const child = spawn(process.argv[0], diff --git a/benchmark/child_process/child-process-read.js b/benchmark/child_process/child-process-read.js index 91c9964e8d1..0ff08af7948 100644 --- a/benchmark/child_process/child-process-read.js +++ b/benchmark/child_process/child-process-read.js @@ -17,12 +17,9 @@ const bench = common.createBenchmark(main, { dur: [5] }); -function main(conf) { +function main({ dur, len }) { bench.start(); - const dur = +conf.dur; - const len = +conf.len; - const msg = `"${'.'.repeat(len)}"`; const options = { 'stdio': ['ignore', 'pipe', 'ignore'] }; const child = child_process.spawn('yes', [msg], options); diff --git a/benchmark/child_process/spawn-echo.js b/benchmark/child_process/spawn-echo.js index 1ce40c3abf4..62f46fb4c0e 100644 --- a/benchmark/child_process/spawn-echo.js +++ b/benchmark/child_process/spawn-echo.js @@ -5,9 +5,7 @@ const bench = common.createBenchmark(main, { }); const spawn = require('child_process').spawn; -function main(conf) { - const n = +conf.n; - +function main({ n }) { bench.start(); go(n, n); } |