-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbanchmarks.js
43 lines (33 loc) · 1.18 KB
/
banchmarks.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var spawn = require('child_process').spawn;
var thunkify = require('thunkify');
var Promise = require('bluebird');
var co = require('co');
var MAX_COUNT = 1000;
function *step(runner, params, count) {
var node = spawn(runner, params.concat('--airlinesCount=' + count));
node.stdout.on('data', function (data) {
process.stdout.write(data.toString());
});
node.stderr.on('data', function (data) {
console.error(data);
});
yield new Promise(function (resolve) {
node.on('close', resolve)
});
count += 50;
count < MAX_COUNT && (yield step(runner, params, count));
}
co(function *() {
console.log('async_cb');
yield step('node', ['async_cb.js'], 10);
console.log('async_promise');
yield step('node', ['async_promise.js'], 10);
console.log('async_generator');
yield step('node', ['async_generator.js'], 10);
//console.log('async_generator_babel');
//yield step('node', ['async_generators_babel.js'], 10);
//console.log('async_traceur');
//yield step('./node_modules/.bin/traceur', ['--experimental', 'async_awayt.js'], 10);
})
.then(console.log.bind(console))
.catch(console.error.bind(console));