Change the first viewport images in amp.dev to improve LCP
Can we remove the animated images as a short term solution?
@matthiasrohmer @kevinkimball @kristoferbaxter
My impression from the profiling that I did on the page is the issue is not the animation but the number of images within the first viewport. But yes, I think if you are ok to remove them entirely that should improve LCP. I can profile it and see
-
If these images are converted to
avifformat, they drop by a significant size.https://amp.dev/static/img/case-band-image-2.jpg?width=330&hash=33e5e2d61e897ee4dc33b6f74f25fdb7207681f9=> from 15kB to 7kB -
With native image support coming soon, the CLS impact is highly reduced (there are two intents to implement in this space). If the AMP Optimizer wants to start making this change in-tandem with the AMP runtime... this would expedite the effort.
We reduced the image count by two with https://github.com/ampproject/amp.dev/pull/4900 - that's not the golden shot yet but should improve things a little.
What I'd like to add to this discussion: I know that the amp.dev homepage should perform well for CWV - also because it is probably the benchmark for folks who think about using AMP and want to see how it performs.
On the other hand the homepage is also the page that sells AMP to potential users who are not that technically versed but judge products by their looks/design. Not saying that this job is necessarily done by the currently selected set of images - we are working with Alex to fix this end at the moment.
Which aspect is more important for you all?
I believe we should be aiming for both, an expressive document that meets Core Web Vitals by using the best recommendations we have available.
This includes using modern image formats, with appropriate sizing.
@matthiasrohmer @sebastianbenz
Couple things
- thumbor doesn't support avif - can we add an early escape for
/.avif$/in the imageOptimizer logic? Or am I being naive? - are we wanting to vary a response to serve the image, or is native image support going to allow us to use
<picture>and<source>withmediaattrs?