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

Enabling the plugin causes a significant build performance regression #54

Open
niieani opened this issue Oct 29, 2018 · 9 comments
Open

Comments

@niieani
Copy link

niieani commented Oct 29, 2018

Hi Stephen,

This seemed like a pretty useful concept, however - when I tried it and enabled the plugin, the build times went from 160 seconds to over 1000 seconds for a full build of our app.

This means that just having the plugin enabled, has caused over a 6x regression in speed. Additionally, the times it measured did not seem accurate, e.g. a plugin which simply adds a property to some modules was measured to have taken 40 seconds (I don't think it's possible that adding a property, even if to over 8000 modules, should take this much time).

Any ideas on what might be going wrong?

@stephencookdev
Copy link
Owner

Hey @niieani

So a regression of 6x speed is definitely unexpected. Would it be possible for you to share your webpack config? Or ideally, link to a full workspace demonstrating the problem?

SMP should cause a slight speed regression (measuring isn't free), so I wouldn't recommend having SMP "on" by default. But yes, as I say - 6x speed regression is too much.

@daton89
Copy link

daton89 commented Nov 8, 2018

i also had the same problem, i removed all the plugins and add them one at time to find which one cause the regression

@niieani
Copy link
Author

niieani commented Nov 8, 2018

Hi @stephencookdev. Our config is dynamically generated and pretty complex, with some proprietary plugins and loaders. Sadly, I don't think I'll have the resources to do anything meaningful in this regard in the foreseeable future :(

@mvgijssel
Copy link

Same here! Using the HardSourceWebpackPlugin and your plugin, it's crazy slow. What can I provide to help you debug?

@harryi3t
Copy link

Same here, went from 57s to 249s
config used

{
  context: path.resolve('some/folder'),
  entry: {
    module1: ['./module1/index.js'],
    module2: ['./module2/index.js'],
    module3: ['./module3/index.js'],
    module4: ['./module4/index.js'],
    module5: ['./module5/index.js']
  },
  output: {
    filename: '[name].js',
    path: path.resolve(projectRoot, 'build', 'js'),
    chunkFilename: '[name].js',
    publicPath: '../js/'
  },
  module: {
    rules: [
      { test: /backbone\.js$/, loader: 'imports-loader?define=>false' }, // turn off Webpack's AMD detection
      {
        test: /\.js$/,
        loader: 'babel-loader',
        options: {
          compact: false,
          cacheDirectory: channel === 'dev'
        },
        exclude: [path.resolve('some/folder', 'node_modules')]
      },
      {
        test: /\.scss$/,
        use: ExtractTextPlugin.extract({
          fallback: 'style-loader',
          use: ['css-loader', 'sass-loader']
        })
      },
      {
        test: /\.(woff2|jpg|svg|png)$/,
        loader: 'url-loader'
      }
    ]
  },
  resolveLoader: { modules: [path.resolve('some/folder', 'node_modules')] },
  resolve: { alias: { 'querystring': path.resolve('some/folder/node_modules', 'querystring-browser') } },
  stats: 'verbose',
  plugins: [
    new webpack.optimize.CommonsChunkPlugin({
      name: 'vendor-ui',
      chunks: ['module1', 'module2', 'module3'],
      minChunks: 3 // Extract out common modules present in all the above three chunks
    }),
    new webpack.optimize.CommonsChunkPlugin({
      name: 'module1',
      async: 'CommonLazyChunk',
      deepChildren: true,
      minChunks: (module, count) => {
        return !(module.resource && (/brace\/worker/).test(module.resource)) && count >= 2;
      }
    }),
    new ExtractTextPlugin('[name].css'),
    new webpack.IgnorePlugin(/^\.\/locale$/), // Ignore moment locale file
    new webpack.IgnorePlugin(/^jquery$/),
    new DuplicatePackageCheckerPlugin({
      verbose: true
    }),
    new webpack.ProvidePlugin({ _: 'lodash' }),
    new webpack.ExternalsPlugin('commonjs', [
     'electron',
     'fs',
     'os',
     'child_process',
     'path',
     'zlib'
   ])
  ]
}

@BlackFenix2
Copy link

yeah, i tried your plugin and my build times went from 50 to 90 seconds. feel free to clone this repo if you want to see the difference, https://github.com/BlackFenix2/Portfolio

@robatwilliams
Copy link

Our ~3 minute build takes 30+ minutes with this plugin enabled, it then emits the files and doesn't quit or output any speed measurements.

@sylvainar
Copy link

Same here, making this plugin completely pointless, too bad.

@wheeler
Copy link

wheeler commented May 5, 2021

One small data point: I also had build times grow to 90+ minutes when adding speed-measure-webpack-plugin. In my case removing case-sensitive-paths-webpack-plugin (which we didn't need) brought build times back to normal. That plugin is added by default if you happen to be using Webpacker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants