Reputation: 1
Hi all and thank you for being a part of this community.
I am working on this website orangecountymovers.com and the render delay and LCP is pretty slow. I've tried preloading elements in hero slider, signed up for siteground premium CDN, cleaned up CSS, and while it improved a bit, it's still pretty bad. Can someone chime in? Thank you!
Added CDN premium on Siteground Added preload to hero banner elements Removed unused CSS
Upvotes: 0
Views: 8230
Reputation: 1573
The proximate cause for the render delay is there's a lot of JavaScript loading and running between when the LCP could be first painted and when it actually is painted.
The LCP is loaded via preload and is found statically in the HTML with an inline style, but that static layout isn't revealed until the scripts are loaded, run their initialization code, and the "preloader" spinner div is removed.
I see a few issues going on here:
More tweaks to CSS, using a CDN, etc aren't going to move the needle on much of this. I'd advise:
bundle your CSS and JS
if the CSS and JS are really necessary for first render, make sure they load before all those images
However, at first glance at least some of that JS isn't necessary for initial interactions and could be deferred both in loading and initialization (e.g. fancy image slide-in animations). Consider splitting your bundles if possible, and deferring initialization of any code not needed for LCP to run even a frame later.
For example, if I disable JS and delete the preloader div, the layout all looks good. The JS isn't necessary to reach LCP at all and that render delay could be 0, the problem is that all the UI also on the page isn't interactive, which isn't a great user experience.
Consider if bundle split points could be used to only initialize what's completely necessary, or, alternatively, hide only the interactive elements and add them back to the page layout as they become initialized. That way the general frame of the page (and the LCP) can be painted immediately as the interactive elements load in. Or find some nice middle ground between these approaches.
Finally, and this isn't going to make a huge difference, but since the preload for your LCP image is working so well right now, make sure to put a fetchpriority="high"
on it to make sure it keeps working well :)
Upvotes: 2