Merged
Conversation
connorjclark
approved these changes
Apr 17, 2024
Collaborator
connorjclark
left a comment
There was a problem hiding this comment.
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
paulirish
approved these changes
Apr 17, 2024
Member
paulirish
left a comment
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
CSSUsageinto two gatherers.CSSUsageonly contains CSS usage information (no stylesheet events or contents) and is not available in timespan modeStylesheetsonly 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-rulesis 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.