question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New audit: prioritize-lcp-image focusing on Priority Hints

See original GitHub issue

Feature request summary

tl;dr rename the preload-lcp-image audit to prioritize-lcp-image, and update it to recommend the use of Priority Hints (shipping in Chrome 101) in cases where the LCP image is found within the main document but queued after other resources.

What is the motivation or use case for changing this?

Currently, the preload-lcp-image does not apply to cases where the LCP image was discoverable from within the main document (see relevant audit logic).

This potentially misses a big opportunity for sites to improve LCP because in many cases—even though those elements are discoverable from the main document—they’re fetched with a low priority and often end up queued up waiting for other resources to finish.

Here’s an example of that happening on httparchive.org

Screen Shot 2022-03-09 at 6 43 00 PM

In this screenshot you can see that the LCP image (the red outline) is discovered immediately, but it’s assigned a “low” priority, so it still gets queued after other resources (e.g. font/stylesheets). In other words, there is clear opportunity to start loading the LCP image sooner, but Lighthouse currently does not highlight this opportunity.

If this site were updated to use Priority Hints and added fetchpriority="high" to the LCP image tag, the trace would look like this:

Screen Shot 2022-03-09 at 6 45 40 PM

Notice how now the image is fetched in parallel with the fonts and stylesheets, and LCP happens at the same time as FCP.

As for what the opportunity value should be: my suggestion is to take the delta between the startTime of the first resource and the requestStart of the LCP resource. Note that I recommend looking at requestStart rather than startTime for the LCP resource because startTime can be the point when the resource was queued (as in the first screenshot above), and the time that’s important is the time the network request started.

Screen Shot 2022-03-09 at 6 43 00 PM copy

How is this beneficial to Lighthouse?

The current preload-lcp-image audit misses lots of opportunity to improve. I recently analyzed all mobile page loads in HTTP Archive where LCP was an image (5M pages) to look at the time delta between when the first resource started loading and when the LCP resource started loading, and those times were surprisingly high.

Passed preload-lcp-audit ? AVG time between 1st resource start and LCP resource start as a % of total LCP time
TRUE 38.4%
FALSE 55.5%

This table shows that pages that pass the audit are doing better than pages that do not pass it, but even for pages that pass the audit, a substantial amount of total LCP time is spent waiting for the LCP resource to start loading.

cc: @paulirish since we discussed this yesterday.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
pmeenancommented, Mar 19, 2022

FWIW, preload helping may also be specific to Chromium (at least in most cases). Chromium is the only engine with the 2-phase loading where it holds back requests for low-priority resources before the parser gets to the body (as long as there are any other high-priority requests in flight, low priority won’t be requested).

Webkit and Gecko both fetch resources as soon as they are discovered, assuming the HTTP/1 connection limit hasn’t been reached.

1reaction
philipwaltoncommented, Apr 15, 2022

@philipwalton should we update https://web.dev/optimize-lcp/ too?

Yeah, I plan to update that post ahead of I/O (to coordinate with some other recommendations).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimizing resource loading with Priority Hints - web.dev
Priority Hints indicate the relative priority of resources to the browser. They can enable optimal loading and improve Core Web Vitals.
Read more >
HUD Consolidated Audit Guide | Office of Inspector General ...
This audit guide is intended to assist independent auditors in performing audits of profit-motivated program participants in selected HUD Housing and Ginnie ...
Read more >
Three Key Priorities for Audit Practitioners in 2022 - ISACA
Priority #1: Audit Strategies​​ The past two years have been about ensuring that resilience is built within the operating model of our ...
Read more >
Program Audits | CMS
Information regarding the Program Audit Process and Protocols, Program Audit and Enforcement Reports, and HPMS Memo's relating to the Program ...
Read more >
Audit Committee Guide - Deloitte
A series of periodic audit committee-focused publications that examines topics impacting the audit committee's responsibilities and priorities. Learn more ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found