Open Bug 1786918 Opened 2 years ago Updated 1 year ago

too much sync decoding of images on https://martyr.shop/products/sealed-bags

Categories

(Core :: Graphics: ImageLib, defect)

defect

Tracking

()

Performance Impact low

People

(Reporter: denschub, Assigned: tnikkel)

References

(Blocks 1 open bug, )

Details

(Keywords: perf:animation, perf:responsiveness, reproducible)

We have received a WebCompat report about janky zoom and pan animations on https://martyr.shop/products/sealed-bags

Looking at the profile provided by the reporter and the profile recorded by Oana, I see that a lot of time is spent in mozilla::image::DownscalingFilter, or rather the sse2::convolve_horizontally call made by the dowscaling filter.

I will note that these photos there are all ~4000x4000px, and have lots of transparency in them, which might be partly to blame here. Everything works fine in Chrome, though.

Couple of things going wrong here.

The page first sets the src of the img to a ~1000 pixel img, and then to a ~4000 pixel image. This happens in under 2 seconds so we wrongly detect it as an img element whose src is changing frequently enough that it is being used as part of an animation

https://searchfox.org/mozilla-central/rev/642be079c4465445ab42b55d18e0a4d644c19c36/dom/base/nsImageLoadingContent.cpp#535

And the img will stay in "sync decoding mode" forever unless the src is changed again. We should make this smarter somehow, and not stay in this mode forever.

This wouldn't be so bad because you can only decode an image once and then we don't have to decode it again, except if we request to draw a differently sized version of the same image and we pass the sync decode flag we synchronously decode to the new size instead of drawing the existing size bilinearly scaled and then later replacing with the better quality scaled version. We should maybe split the sync decode flag into "sync decode if we don't have a frame to show" (or maybe if the frame is too differently sized) and "sync decode no matter what I want the exact version I requested".

Assignee: nobody → tnikkel
Summary: Downscaling large WebP images with transparency is slow → too much sync decoding of images on https://martyr.shop/products/sealed-bags

The Performance Priority Calculator has determined this bug's performance priority to be P3. If you'd like to request re-triage, you can reset the Performance flag to "?" or needinfo the triage sheriff.

Platforms: Windows
Impact on site: Causes noticeable jank
Websites affected: Rare
[x] Affects animation smoothness
[x] Able to reproduce locally

Performance Impact: --- → low
Component: Performance → Graphics: ImageLib

The severity field is not set for this bug.
:aosmond, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(aosmond)
Blocks: 1801052
Severity: -- → S3
Flags: needinfo?(aosmond)
You need to log in before you can comment on or make changes to this bug.