I decided to investigate today while https://twitter.com/ uses so
much CPU when it's displayed.  (I'm using a debug build, and in a
session with a very large number of tabs, which can both skew
things, though probably the oddness is more likely the number of
tabs than the debug build nature, although probably 25% of the time
is debug build stuff.)

What seems to happen is that we're repainting frequently due to an
offscreen animated image,
https://abs.twimg.com/a/1415021474/img/t1/spinner-rosetta-gray-32x32.gif
, which is always near the very bottom of the page and thus very
rarely visible.

But each tick of the animated image (which I believe is a background
image) sends us through ImageLoader::DoRedraw, which in turn calls
nsIFrame::SchedulePaint, so that we do display list analysis to see
if anything changed.  (Nothing has, since the image is well
offscreen.)  But constructing and comparing the display lists takes
a good bit of time, leading to twitter using a good bit of CPU when
it's being displayed.

Is it reasonable to test that the image is offscreen (or, really,
not in the region that's painted into a layer) somewhere earlier in
the process here?  Or is there something else we should be doing to
avoid this?

-David

-- 
𝄞   L. David Baron                         http://dbaron.org/   𝄂
𝄢   Mozilla                          https://www.mozilla.org/   𝄂
             Before I built a wall I'd ask to know
             What I was walling in or walling out,
             And to whom I was like to give offense.
               - Robert Frost, Mending Wall (1914)

Attachment: signature.asc
Description: Digital signature

_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to