Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuya Tanaka <yuya.presto@gmail.com>2016-12-31 18:09:59 +0300
committerItalo A. Casas <me@italoacasas.com>2017-01-27 16:12:01 +0300
commit2f339e7200b560595fe26171f7c9705bcec62b9b (patch)
treeb334dc44e69fd7c7e4f1093af5785fe73c8d8fe6 /benchmark
parentfc2db50021870d933036b0e652c885bcb23bfedb (diff)
benchmark: cleanup child_process IPC benchmark
Squashed from: - child_process: fix IPC bench to obey send() ret val - child_process: fix IPC benchmark message has two more bytes - child_process: use setImmediate for IPC bench PR-URL: https://github.com/nodejs/node/pull/10557 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/child_process/child-process-read-ipc.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/benchmark/child_process/child-process-read-ipc.js b/benchmark/child_process/child-process-read-ipc.js
index 28f2b6f9272..30dead18032 100644
--- a/benchmark/child_process/child-process-read-ipc.js
+++ b/benchmark/child_process/child-process-read-ipc.js
@@ -1,14 +1,20 @@
'use strict';
if (process.argv[2] === 'child') {
const len = +process.argv[3];
- const msg = `"${'.'.repeat(len)}"`;
- while (true) {
- process.send(msg);
- }
+ 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, 32768],
+ len: [
+ 64, 256, 1024, 4096, 16384, 65536,
+ 65536 << 4, 65536 << 8
+ ],
dur: [5]
});
const spawn = require('child_process').spawn;
@@ -18,7 +24,7 @@ if (process.argv[2] === 'child') {
const dur = +conf.dur;
const len = +conf.len;
- const options = { 'stdio': ['ignore', 'ignore', 'ignore', 'ipc'] };
+ const options = { 'stdio': ['ignore', 1, 2, 'ipc'] };
const child = spawn(process.argv[0],
[process.argv[1], 'child', len], options);
@@ -29,8 +35,7 @@ if (process.argv[2] === 'child') {
setTimeout(function() {
child.kill();
- const gbits = (bytes * 8) / (1024 * 1024 * 1024);
- bench.end(gbits);
+ bench.end(bytes);
}, dur * 1000);
}
}