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

I have an idea to speed up incremental build #908

Closed
wxlworkhard opened this issue Mar 26, 2018 · 5 comments
Closed

I have an idea to speed up incremental build #908

wxlworkhard opened this issue Mar 26, 2018 · 5 comments

Comments

@wxlworkhard
Copy link

In index.js file:

compiler.plugin('emit', function (compilation, callback) {
    if (isCompilationCached && self.options.cache && self.options['xxx']) {
        return callback();
    }
    
    var applyPluginsAsyncWaterfall = Promise.promisify(compilation.applyPluginsAsyncWaterfall, {context: compilation});
    // Get all chunks
    var chunks = self.filterChunks(compilation.getStats().toJson(), self.options.chunks, self.options.excludeChunks);
    ......

We can add a xxx attribute to HtmlWebpackPlugin object for incremental build, because hash will not emit generally and url for js will not change.

@jantimon
Copy link
Owner

Could you go a little bit more into detail?

@wxlworkhard
Copy link
Author

@jantimon
When I have 50 entries and create 50 HtmlWebpackPlugin instances, it is very slow for incremental build.

filterChunks, sortChunks, htmlWebpackPluginAssets these three steps take 100ms for each instance and take 5000ms totally.

It is not necessary to do these three steps for incremental build, because self.assetJson will not change.

@jantimon
Copy link
Owner

Thanks for analyzing 👍👍
We already recognised that this has to be improved (especially the sort part!).
The upcoming version will disable sorting by default and prepare other speed optimisations as well.

For now you can try to set sortChunks to none.

@jantimon
Copy link
Owner

@wxlworkhard could you please try if #953 helps to increase your performance problems?

@lock
Copy link

lock bot commented Jul 1, 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 Jul 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants