Skip to content

Conversation

@patrickhulce
Copy link
Collaborator

@patrickhulce patrickhulce commented Dec 1, 2020

Summary
Waits for all critical (high priority) network requests to finish before continuing to the CPU idle check. This solves the issue when the entire page is gated on a single XHR but we move on because we're already at network 2-quiet. This also addresses the problem where the LCP image is very large and added via script where we optimistically report the LCP too early.

The net effect here will be Lighthouse taking a little longer for each run and performance scores dipping as more resources and more CPU work is included in our observations. The net effect on popular sites I tried that don't face the failure case was relatively small. The smoketest and URLs in the linked issues illustrate the massive failure cases we're addressing.

  • CNN, waits an additional ~1s, no observable effect on scores
  • The Verge, waits an additional ~2s, no observable effect on scores
  • ESPN, waits an additional ~1s, no observable effect on scores

Related Issues/PRs
fixes #11180
fixes #10810
fixes #11639

@patrickhulce patrickhulce requested a review from a team as a code owner December 1, 2020 17:15
@patrickhulce patrickhulce requested review from connorjclark and removed request for a team December 1, 2020 17:15
@google-cla google-cla bot added the cla: yes label Dec 1, 2020
* Returns a promise that resolves when the network has been idle (after DCL) for
* `networkQuietThresholdMs` ms and a method to cancel internal network listeners/timeout.
* @param {LH.Gatherer.FRProtocolSession} session
* @param {NetworkRecorder} networkMonitor
Copy link
Collaborator

@connorjclark connorjclark Dec 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(nit unrelated to PR) any reason this isn't called networkRecorder?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just an artifact of how it used to be in driver, though honestly networkMonitor does better express it's usage almost everywhere other than for devtoolsLog creation :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it always confused me b/c there is no network-monitor file. would be nice to rename one or the other

return {promise, cancel: mockCancelFn};
});

return Object.assign(mockFn, {waitForCalls: calls});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if these eyes are for preferring {... that won't work for prototype/class properties of the jest mock fn :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ya I know. I was just eying the rare case where my blanket "use spread!" doesn't work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants