-
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
Preload suggestions are too aggressive #11960
Comments
Yes, preload is often a footgun. Should we do something like #9903 ? |
Oh I remember my third now :) I want something even stronger than that. I want an audit that fails too many preloads at once on mobile. |
Other ideas from discussion:
Later: we can add an audit around reduce-noncritical-preloads because folks have already over-preloaded. Much later: going the opposite direction: are we missing any good preload candidates? "critical" XHRs? Also some discussion on preconnect: perhaps we show all the origins that could be preconnected and tell you to preconnect 2 of them, leaving the onus of choice on them. filed as #12066 |
@patrickhulce I can think of a 4th case:
I first noticed this on a NextJS application. NextJS by default adds a If the page is big enough (a lot of html, a lot of css or a combination of both), several of the preloaded scripts are already downloaded and loaded when the browser reach the bottom of the page, then triggering the execution of those scripts right away, deferring the FCP and LCP. There is this misconception of that script loaded with This is a graph showing FCP before/after we removed the We fixed this by tweaking the code for NextJS, you can see the discussion here After that I've found several sites that has been seen their performance decrease by preloading too much (almost all) of their content. And if you preload everything, you are kind of not preloading anything. |
Thanks for the extra case @dvelasquez! I'm pretty sure Lighthouse would never suggest the developer to preload that case today because it's already discoverable from the main document. A separate audit telling devs not to preload something they're already preloading is definitely up for discussion though!
Yes exactly! That's the situation we're trying to discourage here 👍 Thanks for linking in that next.js discussion too we'll have to sync up with the outcome there |
@patrickhulce Would make sense an audit like: Avoid preload scripts that are intended to load as asynchronous
|
I'm not sure that advice can be so broad as to always apply, which is exactly what we're trying to back away from here, even if it's absolutely true the situation you ran into. AFAIK, some of these preload issues with FCP are actually bugs in preload that are being addressed on the browser-side (see https://bugs.chromium.org/p/chromium/issues/detail?id=788757) If for example there's an app shell with a single async script that renders the primary content and the FCP issue is resolved browser side, I could potentially see preload being used to increase the priority of that script compared to others. |
@patrickhulce Thanks for sharing this. I didn't knew it was a bug, I will follow this closely :) |
Using LH 7.4.0, in one of my sites "Fonts with font-display: optional are not preloaded" complains about the Maybe we can consider this as well: if the right/best font is already preloaded, LH neglects the others in the same |
More discussion offline, the current plan here is:
|
Update here after syncing up with @pmeenan
|
Coming under the wire for 9.0, for now let's just mark this audit as |
TODO: Discuss reenabling |
I asked pmeenan about this and he said...
and also
issue status: uses-rel-preload and preload-fonts are still disabled. we think they're too aggressive to just reenable. and we need to do some work to determine a new policy. and as pat indicates, we may want to adjust our preload-lcp-image audit to suggest priority hints above a preload edit: WPT tweaked some unused-preload reporting stuff here: Add support for reporting unused preloads by pmeenan · #490 · wptagent edit May 23 2022: We previously decided the next action here is for someone to author a design doc to capture the problem space and potential solution space. (There are several preload issues open right now). Phil also has some ideas that would be good to align on. |
I recently came across several partners who had applied
preload
too aggressively in ways that were making every performance metric worse, and when asked why, they shared Lighthouse reports that told them to do so. I think there are a couple culprits in Lighthouse where the preload advice is too aggressive and we should scale back our preload recommendations.Examples:
block
font display when throttling method is simulate (in applied throttling Chrome will have already rendered), tbd language changes that the preload audit isn't meant to be followed blindly, it's a "pick the important 1 or 2" situationThe text was updated successfully, but these errors were encountered: