We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4e1bcdc commit 44be55fCopy full SHA for 44be55f
2 files changed
benchmark/misc/spawn-echo.js
@@ -0,0 +1,25 @@
1
+var common = require('../common.js');
2
+var bench = common.createBenchmark(main, {
3
+ thousands: [1]
4
+});
5
+
6
+var spawn = require('child_process').spawn;
7
+function main(conf) {
8
+ var len = +conf.thousands * 1000;
9
10
+ bench.start();
11
+ go(len, len);
12
+}
13
14
+function go(n, left) {
15
+ if (--left === 0)
16
+ return bench.end(n);
17
18
+ var child = spawn('echo', ['hello']);
19
+ child.on('exit', function(code) {
20
+ if (code)
21
+ process.exit(code);
22
+ else
23
+ go(n, left);
24
+ });
25
benchmark/process_loop.js
0 commit comments