Skip to content
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

Closed
filipesilva opened this issue Aug 29, 2017 · 4 comments
Closed

Comments

@filipesilva
Copy link

Description

This is a feature/refactor request.

html-webpack-plugin currently uses Bluebird promises, which use try...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):

image
image

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:
image

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

Node.js v6.11.1
win32 10.0.15063
npm 5.3.0
[email protected]
[email protected]
@mastilver
Copy link
Collaborator

#762 (comment)

Node was required for node 0.10 but now for webpack 2 we can probably drop that dependency

If you want to submit a PR, go ahead :)

@filipesilva
Copy link
Author

Here is a PR for it :#776. Travis seems happy with it.

@ngyikp
Copy link

ngyikp commented Mar 1, 2018

@jantimon jantimon closed this as completed Mar 1, 2018
@lock
Copy link

lock bot commented May 31, 2018

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.

@lock lock bot locked as resolved and limited conversation to collaborators May 31, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants