Open Bug 1373773 Opened 7 years ago Updated 2 years ago

PCompositorBridge::Msg_NotifyChildCreated sync IPC when opening tabs

Categories

(Core :: Graphics: Layers, enhancement, P3)

enhancement

Tracking

()

Performance Impact low
Tracking Status
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- fix-optional

People

(Reporter: mstange, Unassigned, NeedInfo)

References

(Blocks 2 open bugs)

Details

(Keywords: perf, perf:responsiveness, Whiteboard: [gfx-noted])

Profile: http://bit.ly/2rzzSmg

If you enable Activity Stream using the pref browser.newtabpage.activity-stream.enabled and open new tabs, the parent process sends a synchronous IPC messsage "NotifyChildCreated" to the compositor thread. This slows down tab opening.

The Activity Stream pref makes a difference here because the current "new tab" page runs in the parent process, whereas the new one will run in the content process.

We preload "new tab" tabs, so you may need to open more than one new tab before the issue becomes apparent.
Blocks: UIJank
Given we want to ship Activity Stream soon (that's my understanding, at least), I'm inclined to mark this [qf:p1]. Bas/Milan, WDYT?
Flags: needinfo?(milan)
Flags: needinfo?(bas)
Whiteboard: [qf] → [qf:p1]
This should be measured on a Windows machine where the GPU process is enabled.
Let's answer David's question; can we tie this to a release criteria, or is it a "regular" qf:p1 because of new tab?
The extra content process being created is unintentional, and we're working with e10s folks to make it go away.  I suspect that the strategies currently being bandied about for doing that (bug 1372664 comment 7) would make this notification go away, though I'm not sure about that.  Needinfo to :gabor; :gabor can you confirm or deny my suspicion?
Flags: needinfo?(gkrizsanits)
See Also: → 1372664
Priority: -- → P3
Whiteboard: [qf:p1] → [qf:p1][gfx-noted]
(In reply to Dan Mosedale (:dmose) from comment #4)
> The extra content process being created is unintentional, and we're working
> with e10s folks to make it go away.  I suspect that the strategies currently
> being bandied about for doing that (bug 1372664 comment 7) would make this
> notification go away, though I'm not sure about that.  Needinfo to :gabor;
> :gabor can you confirm or deny my suspicion?

Sorry for the lag I should have answered this earlier, yes that is correct.
Flags: needinfo?(gkrizsanits)
Let's check then when bug 1372664 gets resolved.
Depends on: 1372664
Flags: needinfo?(milan)
Flags: needinfo?(bas)
After lots of back-and-forth about how we're hoping to ship Activity Stream in 56, the code is now in what I _think_ should be its final state for 56: as in the initial comment, much of AS will now be running in a content process rather than the main process. Somewhat related, :gabor has turned off the preallocated content process for now, and as I understand it, that will stay off for 56. 

I expect that the behavior that mstange reported initially is still an issue with the following caveats:

> If you enable Activity Stream using the pref
> browser.newtabpage.activity-stream.enabled and open new tabs, the parent
> process sends a synchronous IPC messsage "NotifyChildCreated" to the
> compositor thread. This slows down tab opening.

This is likely to be most noticable on the first new tab opened in the first browser window, as that one will not be preloaded.  
This is particularly true if a new tab is opened before the maximum number of content processes have been instantiated (i.e. clicking on four links in the home page, and then hitting new tab should just cause the new tab to run in an existing content process).

> We preload "new tab" tabs, so you may need to open more than one new tab
> before the issue becomes apparent.

Note that the first "new tab" in every window will not be preloaded.

:milan, :bas, what's the appropriate next step?
Flags: needinfo?(milan)
Flags: needinfo?(bas)
(In reply to Dan Mosedale (:dmose) from comment #7)

> Note that the first "new tab" in every window will not be preloaded.

I think this is meant to change with bug 1353013.
I'm not sure what the question here is? Is there evidence this is still a problem on Windows? If so do we have a profile of that? I don't see it showing up on a quick glance.

This message is needed, and I believe it has to be synchronous, although I'm no expert on this code. (Is there a way it could be asynchronous David?)

We don't seem to be doing a shocking amount of work inside of it, so without a profile it's hard to tell why it would be slow.
Flags: needinfo?(bas) → needinfo?(dvander)
Indeed it must be synchronous so the compositor can associate the tab with the correct window. The message itself won't cause any performance problems, but it's possible that a previous slow message could cause the sync message to block longer than we want. It's (probably) possible to make it asynchronous but it'd require some kind of significant refactoring of the way TabChild::InitRendering works.

So, we'd want to see evidence of this message impacting Windows responsiveness.
Flags: needinfo?(dvander)
Sounds like we can come back to this at a later date, if and when it starts showing up in a meaningful way in profiles.
Flags: needinfo?(milan)
Ok. Based on Dan's comment 11. I will move this bug to QF:p2 for post 57.
Whiteboard: [qf:p1][gfx-noted] → [qf:p2][gfx-noted]
Here is a profile where it contributes at least 500ms of jank on a fast macbook when opening a couple new tabs: https://perfht.ml/2wIAYKF
Keywords: perf
Jeff, this appears to be a real issue on OS X, this seems to be a -lot- of uploading textures. Have you seen this issue before? Is there anything we can do here to improve the situation? I don't seem to see this on Windows based on a quick glance.
Flags: needinfo?(jmuizelaar)
Whiteboard: [qf:p2][gfx-noted] → [qf:p1][gfx-noted]
Whiteboard: [qf:p1][gfx-noted] → [qf:i60][qf:p1][gfx-noted]
Whiteboard: [qf:i60][qf:p1][gfx-noted] → [qf:f60][qf:p1][gfx-noted]
Whiteboard: [qf:f60][qf:p1][gfx-noted] → [qf:f61][qf:p1][gfx-noted]
Whiteboard: [qf:f61][qf:p1][gfx-noted] → [qf:f64][qf:p1][gfx-noted]
Whiteboard: [qf:f64][qf:p1][gfx-noted] → [qf:p1:f64][gfx-noted]
Bug 1265824 should help with texture upload on macOS, we should see if this is still a problem once that's landed.
Depends on: 1265824
Whiteboard: [qf:p1:f64][gfx-noted] → [qf:p3:responsiveness][gfx-noted]

Florian, if you (or anyone) still see significant jank here (in light of changes per comment 15), please let us know so we can update priority accordingly.

For now, we're assuming there's still some avoidable dependencies between main + compositor threads here, but they're not as bad as they were previously. Hence, qf:p3:responsiveness.

Flags: needinfo?(florian)

Here's a more recent profile that shows that the sync message still exists: https://perfht.ml/2RnZfUY
It is a lot shorter on macOS these days, though: 17ms to 20ms in this profile. It still contributes to a bit of jank in the parent process, but not much.

(In reply to Daniel Holbert [:dholbert] from comment #16)

Florian, if you (or anyone) still see significant jank here (in light of changes per comment 15), please let us know so we can update priority accordingly.

I can't reproduce the problem anymore because we no longer create new content processes when opening activity stream or about:blank in new tabs, they all go in the same "privileged content" process.

Opening new tabs on my super fast macbook is still janky, but when looking at a profile (https://perfht.ml/2H8UJ89) I would blame that on us restyling several times in a row, which seems to be an entirely different bug.

Flags: needinfo?(florian)
Performance Impact: --- → P3
Whiteboard: [qf:p3:responsiveness][gfx-noted] → [gfx-noted]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.