Open Bug 1423398 Opened 7 years ago Updated 3 months ago

High CPU usage with Tree Style Tabs, DisplayList+LayerBuilding

Categories

(Core :: DOM: Animation, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: sfink, Unassigned)

References

Details

In my 59.0a1 (2017-11-30) Nightly, I got into a state where the CPU was churning constantly. https://perfht.ml/2ipLhya

It's massively janking the main thread, with a series of DisplayList then LayerBuilding.

I am running Tree Style Tab. When I show the Bookmarks sidebar instead, the CPU usage goes away. The Usage came back, but not as bad, after I switch back: https://perfht.ml/2iouMCb

mstange says it looks like a CSS animation.
:bbirtles, would you have a chance to look at this profile and confirm?
Component: General → DOM: Animation
Product: Firefox → Core
Version: unspecified → Trunk
Last time I saw the Tree Style Tab code, they run CSS animations on a position:absolute element which is basically out of view.  I guess that is the reason.  We don't throttle such animations yet (bug 1421507).
I'm currently on leave but will have a look next year. At a glance I see mozilla::EffectSet::GetEffectSet in the profile so it does sound like there is some sort of declarative animation (CSS animation/transition or web animation) involved.

That said, if hiro has looked at this before I'm sure he's right about what is going on. We probably need to prioritize bug 1421507 (and bug 1237454) next year.
Flags: needinfo?(bbirtles)
That does appear to be a CSS animation that's spinning the refresh driver there, and it does appear to be running on the main thread. Hiro's analysis in comment 2 seems to be on the mark.

I dug through the source for the extension and I suppose it's the throbber animation to blame since it seems to be the only one that runs infinitely.[1] Furthermore, I notice some of the elements to which that animation is applied and indeed, some are positioned absolutely. I'm guessing we have a tab that is stuck loading that is offscreen causing us to hit bug 1421507.

[1] https://github.com/piroor/treestyletab/blob/91cf2f9432afea64c14035d5f494df9603a5e2d9/webextensions/sidebar/styles/throbber.css#L51
Flags: needinfo?(bbirtles)
Now bug 1421507 has been landed.  So the throbber should not consume CPU. But now I suspect the throbber does not animate due to bug 1421506.
Steve, are you still seeing this on Nightly?

(Or, alternatively, are you seeing the throbber animation *not* animate now as suggested in comment 6?)
Flags: needinfo?(sphink)
I do not see the throbber animating. Then again, I don't recall seeing it animate before, but I can't say I necessarily *would* have noticed either.

The behavior now seems way better. Watching and recording the CPU usage via top, it was the same whether I had the Bookmarks sidebar or the Tree Style Tab sidebar, ranging from 11-28% (while I was monitoring it, TST had *less* CPU usage.) I don't know where that CPU usage is coming from; the browser was idle for all of those time ranges. I grabbed profiles but haven't really looked at them (note that those numbers are with the profiler *off*. I turned it on afterwards, to gather profiles.):

Profile where the last several seconds had TST showing: https://perfht.ml/2qR1TpB
Profile take a little later, where the last few seconds had Bookmarks showing: https://perfht.ml/2qRpsi2

CPU usage is higher when the profiler is active, not that it's relevant.
Flags: needinfo?(sphink)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.