w3c / largest-contentful-paint

Specification for the LargestContentfulPaint API
https://w3c.github.io/largest-contentful-paint/
Other
88 stars 16 forks source link

What exactly does loadTime attribute mean? #118

Closed xiaofud closed 7 months ago

xiaofud commented 11 months ago

Does loadTime mean how long it take the browser to download(load) the image? Or Is it a timestamp indicating when the image starts loading or finishes loading?

clelland commented 11 months ago

loadTime is a timestamp, indicating the time that the image finished loading (but may be before it was actually rendered to the screen).

The timestamp is captured by the Process image that finished loading algorithm in Element Timing, at the point that an image element or CSS background finishes loading. It is then passed to LCP from Report image Element Timing once the image is rendered.

xiaofud commented 11 months ago

loadTime is a timestamp, indicating the time that the image finished loading (but may be before it was actually rendered to the screen).

The timestamp is captured by the Process image that finished loading algorithm in Element Timing, at the point that an image element or CSS background finishes loading. It is then passed to LCP from Report image Element Timing once the image is rendered.

Thanks for explaining! By the way, does renderTime minus loadTime mean how long the browser spent on actually rendering the image?

clelland commented 7 months ago

By the way, does renderTime minus loadTime mean how long the browser spent on actually rendering the image?

It's not guaranteed that the browser spent all of that time rendering; the browser (or the user's computer) may have been busy doing other things during that time as well. It's just the difference in time between when the network load finished, and when the image appeared on screen.

On Chrome, at least, and I expect that other browsers are similar, that time is taken up by image decoding, applying appropriate style and layout, painting the pixels into GPU memory, doing whatever other visual updates are required in the document, and then waiting for the display to actually update.

tunetheweb commented 7 months ago

A couple of other things to consider as well: