moleculerjs / moleculer

:rocket: Progressive microservices framework for Node.js
https://moleculer.services/
MIT License
6.16k stars 587 forks source link

Drop bluebird #528

Closed darky closed 4 years ago

darky commented 5 years ago

Seems native promises (with async await) give impressive performance. Fresh benchmarks on node 12:

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

file                                    time(ms)  memory(MB)
callbacks-baseline                           136       26.98
callbacks-suguru03-neo-async-waterfall       173       40.55
callbacks-caolan-async-waterfall             182       46.45
promises-bluebird-generator                  193       31.79
promises-native-async-await                  227       47.27
promises-lvivski-davy                        231       89.84
promises-bluebird                            235       48.86
promises-cujojs-when                         246       62.32
generators-tj-co                             256       56.29
promises-ecmascript6-native                  267       67.10
promises-then-promise                        298       72.26
promises-tildeio-rsvp                        350       86.40
promises-calvinmetcalf-lie                   430      139.95
promises-dfilatov-vow                        464      131.59
promises-obvious-kew                         558      170.41
observables-pozadi-kefir                     581      137.09
streamline-generators                        591       79.81
promises-medikoo-deferred                    641      133.27
observables-Reactive-Extensions-RxJS         825      229.35
streamline-callbacks                         847      132.60
promises-kriskowal-q                        2336      400.62
observables-caolan-highland                 2474      462.77
observables-baconjs-bacon.js                3658      805.42

Platform info:
Linux 4.19.34-1-MANJARO x64
Node.JS 12.0.0
V8 7.4.288.21-node.16
Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz × 6

Maybe it's time to drop bluebird within of https://github.com/moleculerjs/moleculer/issues/433

icebob commented 5 years ago

You are right, but Node 12 is fresh and not LTS. Lot of developer uses Node 8,10. I think we can drop only in ~v0.15

Wallacy commented 5 years ago

Node 12 will be LTS on 2019-10-XX. Will be very nice to see what the worker_threads will give to the project (when stable).

roonie007 commented 4 years ago

@icebob any news about this issue ?

icebob commented 4 years ago

No any news.

icebob commented 4 years ago

Node 10

Platform info:
==============
   Windows_NT 6.1.7601 x64
   Node.JS: 10.16.0
   V8: 6.8.275.32-node.52
   Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz × 8

Suite: Promise vs BlueBird vs Aigle vs await
√ No promise*                               169,827,247 rps
√ ES6 Promise.resolve*                       11,274,951 rps
√ ES6 new Promise*                           11,719,615 rps
√ Bluebird Promise.resolve*                   5,079,560 rps
√ Bluebird Promise.resolve + 5 x then*        1,105,344 rps
√ Bluebird new Promise*                       7,109,401 rps
√ Aigle Promise.resolve*                     12,550,337 rps
√ Aigle Promise.resolve + 5 x then*           3,226,746 rps
√ Aigle new Promise*                          8,765,586 rps
√ await*                                      7,436,999 rps
√ Aigle Promise.resolve + 5 x then*           2,344,155 rps

Node 12

Platform info:
==============
   Windows_NT 6.1.7601 x64
   Node.JS: 12.14.1
   V8: 7.7.299.13-node.16
   Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz × 8

Suite: Promise vs BlueBird vs Aigle vs await
√ No promise*                               146,991,741 rps
√ ES6 Promise.resolve*                       12,495,557 rps
√ ES6 new Promise*                           12,622,663 rps
√ Bluebird Promise.resolve*                   5,342,943 rps
√ Bluebird Promise.resolve + 5 x then*        1,200,959 rps
√ Bluebird new Promise*                       5,779,400 rps
√ Aigle Promise.resolve*                     11,233,806 rps
√ Aigle Promise.resolve + 5 x then*           2,700,589 rps
√ Aigle new Promise*                          6,978,561 rps
√ await*                                      9,412,061 rps
√ Aigle Promise.resolve + 5 x then*           3,090,279 rps

I think it's very straightforward. We should drop Bluebird because it's 2.5x slower than the native built-in Promise