Bluebird 3.x performance in webpack
See original GitHub issueThis issue seems totally bizarre to me. I’m not sure whether to file it under webpack or Bluebird, but since it may be affecting other bluebird users I’ll file it here.
I’ve been finding that Bluebird’s performance in the browser has been pretty shoddy since I upgraded to bluebird 3.
In an effort to diagnose the problem, I started conducting some tests here: https://github.com/suprememoocow/bluebird-webpack-perf
The results are strange to say the least, but here’s some of what I’m seeing:
- A simple
Promise.reduce
with an array of 100 values takes 2ms when run in Chrome 64bit on OSX. The exact same code, when processed through webpack takes 500ms. - You can compare the implementations here: https://github.com/suprememoocow/bluebird-webpack-perf/blob/master/bluebird-no-webpack.html and https://github.com/suprememoocow/bluebird-webpack-perf/blob/master/bluebird-with-webpack.js
- In an effort to isolate the problem, I’ve minimized the processing that webpack does with the following settings:
module: {
noParse: [
/bluebird\/js\/browser\/bluebird\.js/
]
},
node: {
console: false,
global: false,
process: false,
Buffer: false,
__filename: false,
__dirname: false,
setImmediate: false
},
- Changing these settings hasn’t helped.
- Downgrading to Bluebird 2.x.x fixes the problem.
I’ll conduct some further tests and see if I can get to the bottom of the problem
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Promise.config - Bluebird.js
Bluebird is a fully featured JavaScript promises library with unmatched performance.
Read more >babel-loader - webpack
This package allows transpiling JavaScript files using Babel and webpack. Note: Issues with the output should be reported on the Babel Issues tracker....
Read more >webpack/webpack - Gitter
I dont have devtool set but I have the SourceMapDevToolPlugin enabled and have it ... a really bizarre performance bug when using Webpack...
Read more >Polyfilling Promises Using Bluebird in Webpack 2
Polyfilling Promises Using Bluebird in Webpack 2 · Install the dependencies · Configuring your Webpack · Bonus: jQuery and whatwg-fetch polyfill.
Read more >Bluebird - npm
Full featured Promises/A+ implementation with exceptionally good performance. Latest version: 3.7.2, last published: 3 years ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Doing some profiling I noticed that bluebird is capturing long stack traces even though I have
This would explain why Chrome is getting the performance hit, but not Firefox or Safari.
Upon further investigation, it looks like the
__DEBUG__
constant is being set totrue
for the build ofjs/browser/bluebird.js
if you compare:to the original source, here: https://github.com/petkaantonov/bluebird/blob/master/src/debuggability.js#L18
@petkaantonov, I am using the npm module, which references
js/browser/browser.js
, which is currently built with__DEBUG__
set totrue
. #898 is my attempt at changing this.References:
require('bluebird')
package.json