Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 32fa37f

Browse filesBrowse files
yprestoaddaleax
authored andcommitted
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: #10557 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent cd1a7ea commit 32fa37f
Copy full SHA for 32fa37f

File tree

Expand file treeCollapse file tree

1 file changed

+13
-8
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-8
lines changed
Open diff view settings
Collapse file
+13-8Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
'use strict';
22
if (process.argv[2] === 'child') {
33
const len = +process.argv[3];
4-
const msg = `"${'.'.repeat(len)}"`;
5-
while (true) {
6-
process.send(msg);
7-
}
4+
const msg = '.'.repeat(len);
5+
const send = () => {
6+
while (process.send(msg));
7+
// Wait: backlog of unsent messages exceeds threshold
8+
setImmediate(send);
9+
};
10+
send();
811
} else {
912
const common = require('../common.js');
1013
const bench = common.createBenchmark(main, {
11-
len: [64, 256, 1024, 4096, 32768],
14+
len: [
15+
64, 256, 1024, 4096, 16384, 65536,
16+
65536 << 4, 65536 << 8
17+
],
1218
dur: [5]
1319
});
1420
const spawn = require('child_process').spawn;
@@ -18,7 +24,7 @@ if (process.argv[2] === 'child') {
1824
const dur = +conf.dur;
1925
const len = +conf.len;
2026

21-
const options = { 'stdio': ['ignore', 'ignore', 'ignore', 'ipc'] };
27+
const options = { 'stdio': ['ignore', 1, 2, 'ipc'] };
2228
const child = spawn(process.argv[0],
2329
[process.argv[1], 'child', len], options);
2430

@@ -29,8 +35,7 @@ if (process.argv[2] === 'child') {
2935

3036
setTimeout(function() {
3137
child.kill();
32-
const gbits = (bytes * 8) / (1024 * 1024 * 1024);
33-
bench.end(gbits);
38+
bench.end(bytes);
3439
}, dur * 1000);
3540
}
3641
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.