Last Comment Bug 784920 - Severe periodic jank caused by synchronous reflows in Twitter JavaScript
: Severe periodic jank caused by synchronous reflows in Twitter JavaScript
Status: NEW
[sps][snappy:p2][platform-rel-Twitter]
:
Product: Core
Classification: Components
Component: Layout (show other bugs)
: 16 Branch
: x86_64 Windows 7
: -- normal (vote)
: ---
Assigned To: Robert Sayre
:
Mentors:
http://people.mozilla.com/%7Ebgirard/...
Depends on: 785287
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-22 21:12 PDT by K. Gadd (:kael)
Modified: 2016-06-22 06:50 PDT (History)
17 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---
?


Attachments

Description K. Gadd (:kael) 2012-08-22 21:12:46 PDT
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 (https://twitter.com/) 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.
Comment 1 Benoit Girard (:BenWa) 2012-08-23 11:41:11 PDT
Profile:
http://people.mozilla.com/%7Ebgirard/cleopatra/?report=75408e788127b00f422c31027ce3f9d2438f973f

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.
Comment 2 Benoit Girard (:BenWa) 2012-08-23 11:43:36 PDT
(In reply to Benoit Girard (:BenWa) from comment #1)
> The problem is that we're calling
s/we're/twitter is
Comment 3 Robert Sayre 2012-08-23 13:33:54 PDT
I will look into fixing Twitter.
Comment 4 Robert Sayre 2012-08-23 14:13:04 PDT
This SPS trace is for the twitter embed widget used on third party sites, not twitter.com. We can fix that, but I want to make sure that's the only bug. Are there other traces showing slow scripts from twimg.com? Those would be loaded on twitter.com itself.
Comment 5 K. Gadd (:kael) 2012-08-23 14:22:19 PDT
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).
Comment 6 Benoit Girard (:BenWa) 2012-08-23 20:12:57 PDT
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.
Comment 7 (dormant account) 2012-08-27 14:29:49 PDT
http://people.mozilla.com/~bgirard/cleopatra/?report=98fd80433d4d2105f8d19c163118d15798472f7b managed to catch one of these janks on my faster laptop.
Comment 8 Robert Sayre 2012-09-13 08:11:20 PDT
Any updates on this?
Comment 9 (dormant account) 2012-09-13 12:36:01 PDT
(In reply to Robert Sayre from comment #8)
> Any updates on this?

see comment 7.
Comment 10 Robert Sayre 2012-10-31 08:29:49 PDT
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 twitter.com codebase, rather than the external embedding widget in the URL for this bug. We can work with that.
Comment 11 Florian Bender 2012-11-02 12:46:10 PDT
I experienced this on several pages under spiegel.de (opened in multiple tabs), it caused a "stalled script" alert on one tab. Though after restarting (and closing most if not all spiegel.de tabs), I did not experience severe jank anymore, though I did not open a lot of spiegel.de tabs at once and not all pages (articles) on spiegel.de implement the Twitter widget (maybe they even deleted it? – should check that …). 

Fx 17b3
Comment 12 Lawrence Mandel [:lmandel] (use needinfo) 2012-11-23 09:47:43 PST
Robert - Any update?

Note You need to log in before you can comment on or make changes to this bug.