siakaramalegos / performance-almanac

Repo for organizing and planning the 2021 Web Almanac Performance Chapter
1 stars 0 forks source link

Performant images #3

Open siakaramalegos opened 3 years ago

siakaramalegos commented 3 years ago

If not covered in the Media Chapter:

See #1 for lazy-loading metrics.

Update: Media Chapter will likely cover more of the adoption-type metrics, and we'll cover how they relate to performance metrics.

ziemek-bucko commented 3 years ago

This is great and particularly for image dimensions, easy to look up the median and mean CLS for sites with and without dimensions in place.

rviscomi commented 3 years ago

Lots of metric ideas in this post: https://www.smashingmagazine.com/2021/04/humble-img-element-core-web-vitals/

siakaramalegos commented 3 years ago

@rviscomi which ones specifically? I've read the article and part of the book, but I might not be recognizing the things that are measurable.

rviscomi commented 3 years ago

Taking the intro tips for example:

  • For a fast Largest Contentful Paint:
    • Request your key hero image early.
    • Use srcset + efficient modern image formats.
    • Avoid wasting pixels (compress, don’t serve overly high DPR images).
    • Lazy-load offscreen images (reduce network contention for key resources).
  • For a low Cumulative Layout Shift:
    • Set dimensions (width, height) on your images.
    • Use CSS aspect-ratio or aspect ratio boxes to reserve space otherwise.
  • For low impact to First Input Delay:
    • Avoid images causing network contention with other critical resources like CSS and JS. While not render-blocking, they can indirectly impact render performance.

We can map that to:

siakaramalegos commented 3 years ago

@rviscomi sorry, to clarify, I meant which ones did you want to add that aren't already in the first issue comment in this issue or another one. It's getting to be a bit onerous to sift through all of the suggestions to pull out what is not already covered and only add that rather than having duplicates.

rviscomi commented 3 years ago

I think you have most things covered, I was sharing that post in case it inspired any other metric ideas from anyone else.

samarpanda commented 3 years ago

"Usage of width and height attributes for layout stability (median % of pages and % of images on those pages?)" What if the image proportion is handled by aspect-ratio. This also contributes to image stability.

Wondering if there is a way to measure this 🤔

siakaramalegos commented 3 years ago

@samarpanda added. will discuss with the image chapter author when we meet later this week too.

samarpanda commented 3 years ago

If the LCP is an image for a given page, when was it requested? We can measure this by its request number or request timestamp. For example was it the first request after the HTML was received by the client or were there 15 CSS and JS files in the critical path? Did it take 3 seconds before the image was requested? Across the entire dataset, what is the median critical path length for the LCP image? What is the median wait time before the LCP image was requested?

Curious to know if any preload hinting was defined to prioritize the loading of LCP content if that was an image. Preload hint was defined via http header / html markup.

siakaramalegos commented 3 years ago

@rviscomi when you said "What is the median percent of images on a page that have explicit height/width attributes?" did you mean something beyond width and height set on the <img> or aspect-ratio set in the CSS?

rviscomi commented 3 years ago

Attributes in this case referred specifically to the HTML attributes. The next metric "explicit styles to reserve space" is more concerned with CSS height/width/aspect-ratio. The metrics could be redefined however would be best for you.