-
Notifications
You must be signed in to change notification settings - Fork 20
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
Duplicate Modules: Add option to include their bytes #4069
Conversation
Job #10608: Bundle Size — 301.24KiB (+0.36%).
Bundle metrics
Bundle size by type
View job #10608 report View iFixit:duplicate-true-sizes branch activity View project dashboard |
d972e4d
to
8e5a0f3
Compare
I've rebased this on master to resolve the conflicts. |
8e5a0f3
to
6645d3e
Compare
@vio -- I've incorporated your metric selector UI into this pull. |
@vio -- I don't how to re-record webpack snapshots for the tests, otherwise I would. |
@danielbeardsley, the failed test is not related to your changes. We relied on webpack stats snapshots, and the latest webpack stopped generating deterministic chunk IDs. I updated the tests and they are passing now with the latest webpack, the PR should be ok once you rebase with the latest master. |
In the module info dialog we list the chunks that a module is in. Previously, we only showed the list of chunks that it's in from *one* of the jobs. Listing all chunks allows you to see if a module is duplicated and how that duplication is different across jobs.
Two bundles may have large byte differences mainly because of some modules being duplicated more or less often. The totals show if the whole bundle has grown or shrunk but the modules section couldn't tell you which modules had increased or decreased the number of duplicates. Thus you could know the change was because of altered duplication, but it would be hard to identify which modules caused the change. This hooks up the ModuleMetric selector to include the byte size of the duplicates when comparing module sizes. There are other ways of getting this done, but I tried to choose the least invasive way. doing this operation as a selector allows pretty easy extension to measuring other types (like duplicate count)
They were added for a prior implementation of something and are no longer used /needed.
75e5af6
to
2cda72e
Compare
Done! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @danielbeardsley, looks great!
onClick={() => setModuleMetric(ModuleMetric.TOTAL_SIZE)} | ||
title="Size (including duplicate modules)" | ||
> | ||
Total size |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have the label + title be more explicit, for example: Module total size
? I think we are using Total size
for the entire bundle size in some places.
Also, if we need to make the title stand up, we can use a Tooltip/Hovercard to render it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done! Went for <Tooltip>
and I did change the name. The names aren't the best, but I couldn't think of anything better and the tooltips clear it up I think.
To use the same UI components that are used elsewhere. Also, I changed Total Size to `Module Total Size`. It's not obvious how to better describe these metrics succintly... but that's why we have tooltips.
Thank you @danielbeardsley, looks great! |
Two bundles may have large byte differences mainly because of some
modules being duplicated more or less often.
The totals show if the whole bundle has grown or shrunk but the modules
section couldn't tell you which modules had increased or decreased the
number of duplicates. Thus you could know the change was because of
altered duplication, but it would be hard to identify which modules
caused the change.
This introduces a checkbox on the Modules tab to include the byte size
of the duplicates when comparing module sizes.
There are other ways of getting this done, but I tried to choose the
least invasive way.
Here's a few others I thought of:
allow altering the calculation
duplicates: number
property in each entrytrue size of all duplicates
difference is slight I don't think it's appropriate.
experience with this project.
This also (in the second commit) augments the Module Info dialog to
list out the chunks from each Job instead just the first job.
This somewhat solves the concerns of #3929