core: split up CSSUsage
artifact
#15952
Merged
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
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
.