You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
461 B

'use strict';
const common = require('../common.js');
const bench = common.createBenchmark(main, {
n: [1000]
});
const spawn = require('child_process').spawn;
function main(conf) {
const n = +conf.n;
bench.start();
go(n, n);
}
function go(n, left) {
if (--left === 0)
return bench.end(n);
const child = spawn('echo', ['hello']);
child.on('exit', function(code) {
if (code)
process.exit(code);
else
go(n, left);
});
}