speed-measure-webpack-plugin icon indicating copy to clipboard operation
speed-measure-webpack-plugin copied to clipboard

Enabling the plugin causes a significant build performance regression

Open niieani opened this issue 7 years ago • 9 comments

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?

niieani avatar Oct 29 '18 18:10 niieani

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.

stephencookdev avatar Nov 07 '18 20:11 stephencookdev

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

daton89 avatar Nov 08 '18 00:11 daton89

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

niieani avatar Nov 08 '18 22:11 niieani

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

mvgijssel avatar Dec 28 '18 13:12 mvgijssel

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'
   ])
  ]
}

harryi3t avatar Mar 12 '19 14:03 harryi3t

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

BlackFenix2 avatar Apr 03 '19 01:04 BlackFenix2

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.

robatwilliams avatar Sep 16 '20 14:09 robatwilliams

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

sylvainar avatar Jan 07 '21 09:01 sylvainar

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.

wheeler avatar May 05 '21 20:05 wheeler