A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Expose image decode times in a timing API?

malchata
2017-07-02

We already have the ability to determine page, resource and (at least in Chrome Canary) paint timings in JavaScript. What if we could expose image decode time as a part of the resource timing API?

let resources = window.performance.getEntriesByType("resource");

resources.forEach((resource)=>{
  console.log(resource.name); // "http://example.com/some-image.webp"
  console.log(resource.imageDecode); // 24.12001
});

Or, since this may be somewhat awkward to place into the resource timing API, what if it was its own API?

let images = window.performance.getEntriesByType("images");

images.forEach((image)=>{
  console.log(image.name); // "http://example.com/some-image.webp"
  console.log(image.time); // 24.12001
});

If this is already under consideration, then I apologize-- A cursory google search did not reveal anything like this for me, but my Google Fu can be lacking at times.

EDIT: Relevant tweet.