-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: split up CSSUsage
artifact
#15952
Conversation
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.
This is a good refactor, though I'm not sold on the premise that unused-css-rules is not a useful audit in timespan mode. But I think using CDT for purposes of isolating your CSS to what is needed for initial load + common initial interactions is the more reasonable approach for people needing this information.
CSSUsage
gathererCSSUsage
artifact
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.
yah really like the split of gatherers.
and.. while i'm not jazzed that cssusage (in navigation mode) is underreporting usage because of the timing of our invocation... i'm fine with it, given the confounding factors.
lgtm
Closes #15890
The general problem is that CSS usage tracking has a large performance overhead. Prior to #15865 we were side-stepping the issue by only looking at CSS usage at the end of the navigation. One of the goals if this PR is to revert back to this behavior.
However, it does not make sense to examine CSS usage at a single point in time in timespan mode. So to avoid the performance overhead problem in timespan mode, this PR disables CSS usage tracking in timespan mode. This is achieved by splitting up
CSSUsage
into two gatherers.CSSUsage
only contains CSS usage information (no stylesheet events or contents) and is not available in timespan modeStylesheets
only contains stylesheet events and contents (but no usage information) and is available in all modesThis enables certain audits (e.g.
unminified-css
) to examine the available stylesheets in timespan mode without needing to run through the expensive rule tracking instrumentation.User visible changes:
unused-css-rules
is no longer available in timespan mode. IMO this is a good change because unused CSS shouldn't be a huge issue outside of initial page load anyway.unused-css-rules
.