Skip to content

Commit 44be55f

Browse files
committed
bench: Move process_loop to misc/spawn-echo
1 parent 4e1bcdc commit 44be55f

2 files changed

Lines changed: 25 additions & 19 deletions

File tree

benchmark/misc/spawn-echo.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)