-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor request: replace Bluebird promises with native promises. #772
Comments
If you want to submit a PR, go ahead :) |
Here is a PR for it :#776. Travis seems happy with it. |
v3.0.0 no longer uses bluebird, this issue can be closed |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
This is a feature/refactor request.
html-webpack-plugin
currently uses Bluebird promises, which usetry...catch
. Such blocks are a known de-optimization (GoogleChrome/devtools-docs#53 (comment)) in some versions of V8, like the one present in Node 6 (current LTS). Node 6 also has native promise support though.Thus using Bluebird promises can cause decreased performance. Below are a few screenshots of a Webpack rebuild, showing the deopt is occurring (all within the
innerArrayForEach
group):I tried replacing this specific use of Promise (it's the one in

html-webpack-plugin/lib/compiler.js (compileTemplate)
with a native promise and I observed roughly 200ms savings on a rebuild in that function group:This doesn't mean that all builds would benefit from the same reduction, but since rebuild performance is of high value perhaps this is a worthwhile refactor.
It's worth mentioning that in the V8 engine 6.0 this isn't relevant anymore: https://www.nearform.com/blog/node-js-is-getting-a-new-v8-with-turbofan. But that might be a ways off for a lot of users.
Environment
The text was updated successfully, but these errors were encountered: