| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fc2db50 commit 2f339e7
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,14 +1,20 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | if (process.argv[2] === 'child') { | |
| 3 | 3 | 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(); | ||
| 8 | 11 | } else { | |
| 9 | 12 | const common = require('../common.js'); | |
| 10 | 13 | 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 | + ], | ||
| 12 | 18 | dur: [5] | |
| 13 | 19 | }); | |
| 14 | 20 | const spawn = require('child_process').spawn; | |
@@ -18,7 +24,7 @@ if (process.argv[2] === 'child') { | |||
| 18 | 24 | const dur = +conf.dur; | |
| 19 | 25 | const len = +conf.len; | |
| 20 | 26 | ||
| 21 | - const options = { 'stdio': ['ignore', 'ignore', 'ignore', 'ipc'] }; | ||
| 27 | + const options = { 'stdio': ['ignore', 1, 2, 'ipc'] }; | ||
| 22 | 28 | const child = spawn(process.argv[0], | |
| 23 | 29 | [process.argv[1], 'child', len], options); | |
| 24 | 30 | ||
@@ -29,8 +35,7 @@ if (process.argv[2] === 'child') { | |||
| 29 | 35 | ||
| 30 | 36 | setTimeout(function() { | |
| 31 | 37 | child.kill(); | |
| 32 | - const gbits = (bytes * 8) / (1024 * 1024 * 1024); | ||
| 33 | - bench.end(gbits); | ||
| 38 | + bench.end(bytes); | ||
| 34 | 39 | }, dur * 1000); | |
| 35 | 40 | } | |
| 36 | 41 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments