-
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(prioritize-lcp-image): report negative savings as 0 #16276
base: main
Are you sure you want to change the base?
core(prioritize-lcp-image): report negative savings as 0 #16276
Conversation
@@ -216,7 +216,7 @@ class PrioritizeLcpImage extends Audit { | |||
} | |||
|
|||
const wastedMs = lcpTimingsBefore.endTime - | |||
Math.max(lcpTimingsAfter.endTime, maxDependencyEndTime); | |||
Math.max(lcpTimingsAfter.endTime, maxDependencyEndTime > lcpTimingsBefore.endTime ? lcpTimingsBefore.endTime : maxDependencyEndTime); |
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.
Another option would be to throw an error for this case, what do you think? Do we need to dig deeper into why maxDependencyEndTime
is greater than lcpTimingsAfter.endTime
?
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.
Let's not throw an error, but I don't think this PR should close #16261
Also could we do something like wastedMs = Math.max(wastedMs, 0)
on the line below this. I think that would make this easier to read.
I don't like this sort of fix because it covers up this and future problems. I suggest not doing this, but defer to @adamraine |
Part of #16261.