offscreen animated images and doing repaint work
"L. David Baron" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.layout |
|---|---|
| Message-ID | <[email protected]> |
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)
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout
signature.asc
(application/pgp-signature, 819 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCAAGBQJUWscyAAoJEO/hYSUPhPwhCboP/1VpYd43CzvRmSEs7ZKDZ+Tg 1hNZw43F8GZYR7urH6I07mtuuI8cUEDt89hD65j4Hk9E5r4IHSsFtMxg4QAbpUaA miG2hO5hXp2KGrBIyIi18794VZBL7KQmb3ec/MPzgZNrMa3RnVsyZix3mtqDRwMY EXKhN2lN5KKlZIIqzHJcgzEPsWoU6mCPEvT6CVOMBPNDLVZ02U2+waMEl5N7bus4 eorAj1uKeKtBci8njvzkFI6Pqfe45LRsRLy2tuh8LUCowSRacvyVpmdqBEQPOo/W coRjXd3/JuTnMuNCY4zodtXE7xPrUijGCODZzBFjZwTtwiPHqAPJYGVQKwQxB1wk DbJlic/rX2aV0p7yyidlQ7D9radx/WhiDi2Eg6PnEBt0UUa19DnIztm4Uc1s5qPj qJVbEjMHqSN1VOzKjn/bV+XDpB4VwYz62aGbFJyJA0ut/w2cPr8h3phGUzkQSoe2 kfB5lzye5v0ywkJiziwIuamoRxeaW01121KqHnVYHicRVlV9C5FiTSqQRAusAFna klx/9/vmlcbxJrilX0J3dTu9ohpPzVNaZ6rv9FzYkIhA/2WAwxXKWvQBahQy2y6r ABsWFS/YPYUEmdKWLE3LqW8rKBUWlSA0eBHTw6dit5GWbZrbhpv+wsJ5ewR/Vsrt oLzhtBe6nx19C98ePNob =S6DF -----END PGP SIGNATURE-----