Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Don't download images which will be downscaled by a factor of more than N. #40

Closed
tdresser opened this issue Dec 14, 2016 · 8 comments
Closed

Comments

@tdresser
Copy link

It's fairly common that pages have massive images which are downscaled before being displayed (citation needed).

We often don't need to download much of an image before we know it's size. If we know that an image is way bigger than its display size, we could refuse to download the rest of it.

This would encourage the ecosystem to stop serving giant images, and would decrease the amount of time spent downloading giant images.

The first step would be gathering some metrics around how often images are downscaled ridiculous amounts.

I don't have a strong sense of how big an issue this is in practice. Any thoughts?

@igrigorik
Copy link
Member

If memory serves, @samdutton looked into this before and might have some data.

Alternatively, we can instrument HTTP Archive to pull this on next crawl.

@samdutton
Copy link

samdutton commented Dec 16, 2016 via email

@igrigorik
Copy link
Member

A while back I did build an extension that checks for incorrectly sized (and single pixel) images..

Ah, right, that's what I was thinking of.. thanks :)

@tdresser
Copy link
Author

Instrumenting http archive seems like a reasonable approach. Who is the right person to drive that?

@r-barnes
Copy link

I think this is a lovely idea.

@igrigorik
Copy link
Member

The first step would be gathering some metrics around how often images are downscaled ridiculous amounts.

@rviscomi I believe we now have this data in HA as part of LH audits?

@rviscomi
Copy link

@igrigorik yes the uses-responsive-images audit should encompass this:

Serve images that are appropriately-sized to save cellular data and improve load time. Learn more.

It's currently available in the 6/1 and 6/15 android_pages tables.

@rviscomi
Copy link

Taking a quick stab at this:

SELECT
  NTH(251, QUANTILES(CAST(JSON_EXTRACT_SCALAR(lighthouse, "$.audits['uses-responsive-images'].score") AS FLOAT), 1001)) AS p25,
  NTH(501, QUANTILES(CAST(JSON_EXTRACT_SCALAR(lighthouse, "$.audits['uses-responsive-images'].score") AS FLOAT), 1001)) AS p50,
  NTH(751, QUANTILES(CAST(JSON_EXTRACT_SCALAR(lighthouse, "$.audits['uses-responsive-images'].score") AS FLOAT), 1001)) AS p75,
  AVG(JSON_EXTRACT(lighthouse, "$.audits['uses-responsive-images'].score")) AS avg
FROM
  [httparchive:har.2017_06_15_android_pages]
WHERE
  lighthouse != 'null'
p25	0.0
p50	90.0
p75	100.0
avg	58.6

@johannhof
Copy link
Member

(As noted in #72, we intend to archive this repository and are thus triaging and resolving all open issues)

I think having this in Lighthouse is a great idea, In addition to that there's a proposed oversized-images policy which could help as well. However, it doesn't seem like there's active development on it at the moment. Restarting that effort (potentially as a separate WICG proposal) seems like the most promising way forward. In the meantime, I think it's safe to close this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants