Skip to content
winterland edited this page Oct 25, 2015 · 13 revisions

Use Action.js to run bluebird's benchmark, you can clone it, see what it does and run, note that:

  • bluebird use lots of v8-specific optimizations, take a look at its promisify, it's hilarious and open my eye.

  • Q have some problems with node v4.x, it will run much faster under node v0.12.

$ ./bench doxbee 
...
results for 10000 parallel executions, 1 ms per I/O op

file                                     time(ms)  memory(MB)
callbacks-baseline.js                         164       32.56
action-generator.js                           191       33.17
promises-bluebird-generator.js                211       34.88
action.js                                     272       62.25
promises-bluebird.js                          287       45.13
promises-cujojs-when.js                       347       68.20
promises-tildeio-rsvp.js                      389       70.67
callbacks-caolan-async-waterfall.js           457       77.45
promises-lvivski-davy.js                      590      125.20
promises-dfilatov-vow.js                      644      142.25
promises-calvinmetcalf-lie.js                 664      150.31
promises-ecmascript6-native.js                829      187.14
generators-tj-co.js                           911      142.82
promises-obvious-kew.js                      1450      266.47
promises-then-promise.js                     1503      209.71
promises-medikoo-deferred.js                 2177      191.76
observables-pozadi-kefir.js                  2739      164.27
observables-Reactive-Extensions-RxJS.js      3078      283.14
observables-baconjs-bacon.js.js             19276      855.48
promises-kriskowal-q.js                     23863      886.04
observables-caolan-highland.js              26877      528.03

Platform info:
Darwin 14.5.0 x64
Node.JS 4.2.1
V8 4.5.103.35
Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz × 8

$ ./bench doxbee-errors
...
results for 10000 parallel executions, 1 ms per I/O op
Likelihood of rejection: 0.1

file                                 time(ms)  memory(MB)
callbacks-baseline.js                     191       32.28
action-generator.js                       195       33.20
promises-bluebird-generator.js            238       33.45
action.js                                 282       62.11
promises-bluebird.js                      371       54.04
promises-cujojs-when.js                   397       76.52
promises-tildeio-rsvp.js                  418       70.13
callbacks-caolan-async-waterfall.js       444       77.61
promises-lvivski-davy.js                  448       83.30
promises-dfilatov-vow.js                  683      147.38
promises-obvious-kew.js                  1349      265.62
promises-then-promise.js                 1535      214.95
promises-kriskowal-q.js                 22411      871.87
promises-calvinmetcalf-liar.js            OOM         OOM
promises-medikoo-deferred.js              OOM         OOM

Platform info:
Darwin 14.5.0 x64
Node.JS 4.2.1
V8 4.5.103.35
Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz × 8

$ ./bench parallel
...
results for 10000 parallel executions, 1 ms per I/O op

file                                time(ms)  memory(MB)
action-callback.js                       253       74.64
promises-bluebird.js                     370       85.83
promises-bluebird-generator.js           419       90.03
callbacks-baseline.js                    516       38.11
action.js                                520      150.52
promises-tildeio-rsvp.js                 578      190.33
promises-cujojs-when.js                  698      135.22
callbacks-caolan-async-parallel.js      1019      190.96
promises-lvivski-davy.js                1238      248.95
promises-calvinmetcalf-lie.js           1338      353.20
promises-ecmascript6-native.js          1853      504.09
promises-dfilatov-vow.js                1894      500.30
promises-then-promise.js                2130      660.55
promises-medikoo-deferred.js            4747      535.64
promises-obvious-kew.js                 6127     1099.04

Platform info:
Darwin 14.5.0 x64
Node.JS 4.2.1
V8 4.5.103.35
Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz × 8

I also wrote a small bench, check it yourself to see what it does.

$ coffee test/bench.coffee

Node v4.2.1
OS   darwin
Arch x64
CPU  Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz

Sequence run sync operation 100000 times:

Native
init time:  212ms
total time: 318ms
memory:     rss - 107mb | heapTotal - 81mb | heapUsed - 76mb


Bluebird v2.9.34
init time:  27ms
total time: 75ms
memory:     rss - 135mb | heapTotal - 122mb | heapUsed - 95mb


Action.js v1.0.0
init time:  24ms
total time: 24ms
memory:     rss - 150mb | heapTotal - 123mb | heapUsed - 100mb

Sequence run async operation 1000 times:

Native v2.9.34
init time:  1ms
total time: 1437ms
memory:     rss - 150mb | heapTotal - 123mb | heapUsed - 103mb


Bluebird v2.9.34
init time:  1ms
total time: 1450ms
memory:     rss - 151mb | heapTotal - 124mb | heapUsed - 106mb


Action.js v1.0.0
init time:  0ms
total time: 1410ms
memory:     rss - 151mb | heapTotal - 124mb | heapUsed - 92mb
Clone this wiki locally