Severe periodic jank caused by synchronous reflows in Twitter JavaScript




7 years ago
3 years ago


(Reporter: kael, Assigned: sayrer)


16 Branch
Windows 7

Firefox Tracking Flags

(platform-rel ?)


(Whiteboard: [sps][snappy:p2][platform-rel-Twitter], URL)



7 years ago
URL is a SPS trace.

In the past couple days I've been seeing really horrible periodic jank in Aurora. After seeing the main thread hang for an entire 4 seconds, I switched over to Nightly and turned on SPS. I haven't seen any multisecond pauses, but I am seeing frequent 80+ms pauses caused by what appear to be synchronous reflows. They all seem to be caused by twitter's JS (at least according to SPS's data), which makes sense, because I have twitter pinned in an app tab.

The twitter app tab is just my logged in account on the default page ( without being scrolled down. I think the jank may have been worse in some cases if I was scrolled down, though.

It is unclear whether this got worse because of something that recently landed on Aurora, or if the Twitter guys just broke it.

The jank occurs regardless of what the active tab is.
Whiteboard: [sps][snappy]

The problem is that we're calling getOffsetHeight (filter by getOffsetHeight in the profile) which in this case is blocking the browser for .4 sec. This is called often so it causes periodic jank like described.

Let's see if we can reach twitter, most sites do this without realizing just how expensive this call is.
(In reply to Benoit Girard (:BenWa) from comment #1)
> The problem is that we're calling
s/we're/twitter is

Comment 3

7 years ago
I will look into fixing Twitter.
Assignee: nobody → sayrer

Comment 4

7 years ago
This SPS trace is for the twitter embed widget used on third party sites, not We can fix that, but I want to make sure that's the only bug. Are there other traces showing slow scripts from Those would be loaded on itself.

Comment 5

7 years ago
That's weird. I don't think I have anything open with a twitter widget in it - my fixed set of tabs are just gmail, twitter, ycombinator. 
I guess each jank could have been from me opening a page with the twitter widget in it, though. It's odd also because the jank went away when I installed an addon that suspends background tabs (i.e. twitter and gmail).
I've got a patch in bug 785287 ready to go that will give us the document URL in the profile for which we trigger a reflow. Inbound is closed but it should hopefully be in the nightly on the 25th.
Depends on: 785287

Comment 8

7 years ago
Any updates on this?

Comment 9

7 years ago
(In reply to Robert Sayre from comment #8)
> Any updates on this?

see comment 7.

Comment 10

7 years ago
Hey there, last time I visited this bug, I that cleopatra link in comment 7 didn't work.

That profile shows jank that's definitely in the main codebase, rather than the external embedding widget in the URL for this bug. We can work with that.

Comment 11

7 years ago
I experienced this on several pages under (opened in multiple tabs), it caused a "stalled script" alert on one tab. Though after restarting (and closing most if not all tabs), I did not experience severe jank anymore, though I did not open a lot of tabs at once and not all pages (articles) on implement the Twitter widget (maybe they even deleted it? – should check that …). 

Fx 17b3
Robert - Any update?


6 years ago
Whiteboard: [sps][snappy] → [sps][snappy:p2]
Whiteboard: [sps][snappy:p2] → [sps][snappy:p2][platform-rel-Twitter]
platform-rel: --- → ?
Benoit, is this bug obsolete now?
Flags: needinfo?(bgirard)
Yes, at this point it would be better to restart a new bug and investigation if there's still a problem. All the data here has rotted.
Last Resolved: 3 years ago
Flags: needinfo?(bgirard)
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.