ShuiRuTian / time-analytics-webpack-plugin

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

[BUG] This plug-in gives a different time than webpack Compiled successfully time #1

Closed codelzb closed 1 year ago

codelzb commented 1 year ago

Describe the bug I am not sure if this is a display error,webpack gives the total time of 7102ms,time-analytics-webpack-plugin is 7093.857900001109ms, What puzzles me is that All loaders take 25601.421200003475ms

Screenshots image

ShuiRuTian commented 1 year ago

I agree it is kind of confused.

Let me explain a bit about how to measure the time for Webpack compile time and loader time:

For webpack compile time, we use internal hook "compile" and "done", record the time and calculate the difference, pretty easy.

For loaders, this is kind of different. Each time the loader is executed for some resource, we record the start time and end time. But this might be parallel, and we will accumulate the total time. Also, if the loader is async, we record the end time when the loader function is finally resolved.

ShuiRuTian commented 1 year ago

So,

If you think this resolve your issue: To reduce the similar confusion from others, do you have any friendly suggestions on the output of the plugin? (Feel free to just close this issue)

If you think this is still a bug that need to be fixed: According to the unusual assumed name of your loaders, I believe you are using some framework, could you please provide a minimal repo or some steps to reproduce this issue?

codelzb commented 1 year ago

After I understand these reasons, I don't think it will affect my optimization of webpack config,But I hope the official version will do better in the future, such as the parallel and asynchronous cases you mentioned