ShuiRuTian / time-analytics-webpack-plugin

Analytics the time cost of loaders and plugins in webpack, to optimise accordingly.
32 stars 0 forks source link

[BUG]: Reporting incorrect timing #5

Open subha84 opened 1 year ago

subha84 commented 1 year ago

Describe the bug The timing reported by the plugin is not matching up with the final timing. It is not even close time the whole build process is taking.

To Reproduce No - The code cannot be shared for copyright reasons.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots

[15:56:31] info: + config-overrides: webpack config (1.27 s) [15:56:32] info: + Creating an optimized production build... [15:56:32] error: + (node:13804) [DEP_WEBPACK_COMPILATION_OPTIMIZE_CHUNK_ASSETS] DeprecationWarning: optimizeChunkAssets is deprecated (use Compilation.hooks.processAssets instead and use one of Compilation.PROCESS_ASSETSSTAGE* as stage option) [15:56:32] error: + (Use node --trace-deprecation ... to show where the warning was created) [15:58:04] info: + ┌── time-analytics-webpack-plugin [15:58:04] info: + │ Webpack compile takes 91435.4843 ms [15:58:04] info: + ├── Plugins [15:58:04] info: + │ Plugin MonacoEditorWebpackPlugin takes 43681.1746 ms [15:58:04] info: + │ Plugin ESBuildMinifyPlugin takes 11997.3791 ms [15:58:04] info: + │ Plugin CssMinimizerPlugin takes 9700.0434 ms [15:58:04] info: + │ Plugin WebpackManifestPlugin takes 5569.0431 ms [15:58:04] info: + │ Plugin HtmlWebpackPlugin takes 2763.2416 ms [15:58:04] info: + │ Plugin SvgCompilePlugin takes 2341.8081 ms [15:58:04] info: + │ Plugin CopyPlugin takes 1246.4570 ms [15:58:04] info: + │ Plugin ConfigBuilderPlugin takes 55.3637 ms [15:58:04] info: + │ Plugin MiniCssExtractPlugin takes 32.5483 ms [15:58:04] info: + │ Plugin TerserPlugin takes 12.8165 ms [15:58:04] info: + │ Plugin DefinePlugin takes 4.4297 ms [15:58:04] info: + │ Plugin VmDepsCachePlugin takes 1.6727 ms [15:58:04] info: + │ Plugin InlineChunkHtmlPlugin takes 0.2375 ms [15:58:04] info: + │ Plugin ModuleNotFoundPlugin takes 0.2255 ms [15:58:04] info: + │ Plugin ProvidePlugin takes 0.1858 ms [15:58:04] info: + │ Plugin InterpolateHtmlPlugin takes 0.0549 ms [15:58:04] info: + │ All plugins take 77406.6815 ms [15:58:04] info: + ├── Loaders [15:58:04] info: + │ Loader babel-loader takes 1000254.8325 ms [15:58:04] info: + │ Loader mini-css-extract-plugin takes 105795.9664 ms [15:58:04] info: + │ Loader source-map-loader takes 29868.4696 ms [15:58:04] info: + │ Loader @swf/tooling takes 9012.2357 ms [15:58:04] info: + │ Loader @swf/tooling takes 1842.5167 ms [15:58:04] info: + │ Loader postcss-loader takes 325.2250 ms [15:58:04] info: + │ Loader css-loader takes 90.8823 ms [15:58:04] info: + │ Loader @swf/tooling takes 7.2237 ms [15:58:04] info: + │ Loader @swf/tooling takes 5.9137 ms [15:58:04] info: + │ Loader @swf/tooling takes 2.5375 ms [15:58:04] info: + │ Loader @swf/tooling takes 2.5195 ms [15:58:04] info: + │ Loader @swf/tooling takes 2.1642 ms [15:58:04] info: + │ Loader @swf/tooling takes 1.6582 ms [15:58:04] info: + │ Loader @swf/tooling takes 1.4676 ms [15:58:04] info: + │ Loader @swf/tooling takes 0.7984 ms [15:58:04] info: + │ Loader @swf/tooling takes 0.4106 ms [15:58:04] info: + │ Loader @swf/tooling takes 0.3982 ms [15:58:04] info: + │ Loader @swf/tooling takes 0.2583 ms [15:58:04] info: + │ Loader @swf/tooling takes 0.2370 ms [15:58:04] info: + │ Loader @swf/tooling takes 0.0970 ms [15:58:04] info: + │ There are many different loaders that have same assumed name. Consider use "loader.groupedByAbsolutePath" option to show the full path of loaders. [15:58:04] info: + │ All loaders take 1147215.8121 ms [15:58:04] info: + ... linked out/site/showcase to out/site_last [15:58:04] info: Compiled successfully. (1.53 min) [15:58:10] info: Successful (1.73 min)

The whole build process is taking 1.73 mins but the tool is reporting incorrectly. Timing reported by the tools Loaders : 1147215.8121 ms = ~19min Plugins: 77406.6815ms = ~1.5 mins

Additional context Add any other context about the problem here.

ShuiRuTian commented 1 year ago

This might not be a bug, I am not sure.

Please reference this section firstly: https://github.com/ShuiRuTian/time-analytics-webpack-plugin/tree/main/packages/time-analytics-webpack-plugin#output

However, 19min is still too large, are you using thread-loader or something like it? We only calculate the total time of a loader for now, which means if a loader runs on 8 cores at the same time, the result will roughly be 8 times of webpack spent time.

DzmVasileusky commented 1 year ago

I have the same issue with loaders time https://github.com/ShuiRuTian/time-analytics-webpack-plugin/issues/8 It is more like 100 times larger not 8