LoginSignup
16
12

More than 5 years have passed since last update.

ES6のPromiseはBluebirdの4倍遅いらしい

Posted at

benchmarkページから

ES6で標準搭載されたpromiseはbluebirdよりも遅いしメモリを食うらしい、というのを初めて知った。

きっかけはQとbluebirdのパフォーマンス比較を調べていた時に偶然見つけた以下の記事。

bluebirdのGitHubにbenchmarkページがあった。
https://github.com/petkaantonov/bluebird/tree/master/benchmark

処理を1万回並列に実行したら、
ES6 promiseはbluebirdの4倍、
Qは40倍スピードの差があったらしい。

なぜ差が出るのか?について質問していた人がいた。
Why are native ES6 promises slower and more memory-intensive than bluebird?
http://programmers.stackexchange.com/questions/278778/why-are-native-es6-promises-slower-and-more-memory-intensive-than-bluebird

速度の最適化をしているかどうかってことだろう。動作環境も関係しているみたいだけど。
Qとbluebirdの差異については、目的の違いによるものらしい。速度を取るか、安全性を取るか。

Q vs. Bluebird performance
https://github.com/petkaantonov/bluebird/issues/381

As far as I know, its because one of the primary goals of Q is to provide certain security properties of promises in browsers. Bluebird on the other hand is designed for performance, to be used in environments such as node where the entire code is fully trusted.

実装するならサーバーサイドはbluebirdで、クライアントサイドはQってことだろうか。

16
12
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
12