Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

adamsilverstein
Copy link

@adamsilverstein adamsilverstein commented Dec 5, 2024

Part of #16261.

@adamsilverstein adamsilverstein requested a review from a team as a code owner December 5, 2024 23:06
@adamsilverstein adamsilverstein requested review from connorjclark and removed request for a team December 5, 2024 23:06
@@ -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);
Copy link
Author

@adamsilverstein adamsilverstein Dec 5, 2024

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?

Copy link
Member

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.

@adamsilverstein adamsilverstein changed the title Report wastedMs as 0 when maxDependencyEndTime > lcpTimingsBefore.end… Report wastedMs as 0 instead of a negative number [type-bug] Dec 5, 2024
@adamraine adamraine changed the title Report wastedMs as 0 instead of a negative number [type-bug] core(prioritize-lcp-image): report negative savings as 0 Dec 9, 2024
@connorjclark
Copy link
Collaborator

connorjclark commented Dec 11, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants