Open Bug 1553980 Opened 6 years ago Updated 5 days ago

Defer initial processing by Privileged Content process at startup

Categories

(Firefox :: New Tab Page, defect, P3)

35 Branch
defect

Tracking

()

Performance Impact medium

People

(Reporter: jesup, Unassigned)

References

Details

(Keywords: perf:resource-use)

The Privileged Content process does a lot of CPU use right after browser start; we should consider deferring it until the browser has been idle for a while.

See https://perfht.ml/2I2LrIf (Process 16834); it was highly busy for 1 second at start, then occasionally busy after that. See https://perfht.ml/2HOkacm

In another context (different bug), it was mentioned that if a thumbnail fails to render before shutdown it apparently will start rendering again on startup. Any such rendering should be deferred until an idle period after startup.

Also: startup-time CPU use has a disproportionate impact on GeckoView, since browser (re)starts are far more common.

Whiteboard: [qf] → [qf][geckoview]

Could you clarify what you're talking about here? We were confused in triage because you mentioned thumbnail rendering and new-tab, and GeckoView, but the GeckoView (Fenix) new-tab page doesn't show thumbnails, as far as I know.

(We're also not sure what exactly the Privileged Content Process does, particularly in GeckoView, and which of its tasks are deferrable vs. important-to-do-ASAP)

Flags: needinfo?(rjesup)

Right, this might not apply to GeckoView currently... though if geckoview ever extends beyond android it's unclear if this would apply (probably not; any privileged content process might be a separate geckoview instance I'd guess).

Flags: needinfo?(rjesup)
Whiteboard: [qf][geckoview] → [qf]
Whiteboard: [qf] → [qf:p2:resource]

The priority flag is not set for this bug.
:tspurway, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(tspurway)
Flags: needinfo?(tspurway)
Priority: -- → P3
Component: New Tab Page → Activity Streams: Newtab
Priority: P3 → --

Ed, can you do some quick debugging and advise on LOE and Priority to get this fixed? Thanks!

Blocks: perf-tweaks
Flags: needinfo?(edilee)

A quick sanity check, does setting browser.pagethumbnails.capturing_disabled to true make things any better? Additionally, I see no javascript stacks from the profiles in comment 0, so perhaps those weren't captured? Would help tracking down from activity-stream / thumbnail side as all the code is js.

Flags: needinfo?(edilee) → needinfo?(rjesup)

(In reply to Ed Lee :Mardak from comment #6)

A quick sanity check, does setting browser.pagethumbnails.capturing_disabled to true make things any better? Additionally, I see no javascript stacks from the profiles in comment 0, so perhaps those weren't captured? Would help tracking down from activity-stream / thumbnail side as all the code is js.

simpleperf can't record JS stacks (it's basically 'perf' and we can't use the --enable-perf build option to get (bad) JS stacks without some work..)

jesup, are you noticing this even when about:home/newtab are not open at startup? The privileged content process should only be used by those pages and with bug 1353013, I believe the preloaded about:newtab does get deferred.

Looking at the profiles from comment 0, they look like regular new tab rendering the page on first data hydration of sites and content to display.

Moving this to P3 (backlog) until we have information to translate this into actionable work. Please keep us posted :jesup & :Mardak. Thanks!

Priority: -- → P3
Component: Activity Streams: Newtab → New Tab Page
No longer blocks: pocket-newtab

Andrew - next time you look at a simpleperf startup profile, can you check the status of this? Thanks

Flags: needinfo?(rjesup) → needinfo?(acreskey)

I've captured simpleperf startup profiles from a recent Fenix build. (Release build variant, but with android debuggable=true so that I can simpleperf).

But I'm not seeing the Privileged Content process.
https://share.firefox.dev/34dLI7D

Another one, this one captured the content process:
https://share.firefox.dev/32482hm

The startup method is applink via adb intent.

Flags: needinfo?(acreskey)

I don't think privileged content exists in Geckoview: "Right, this might not apply to GeckoView currently.." above... This is a general bug.
Also, while I said "simpleperf" (not sure why), these problems were all seen with 'perf' profiles on desktop (linux)

Performance Impact: --- → P2
Whiteboard: [qf:p2:resource]
Severity: normal → S3

Recent profile from a local Mac build: https://share.firefox.dev/41igXLC

Yes there is CPU activity in the privileged content process during startup, but overall I'd say we have bigger CPU time issues in the parent process these days.

The profile shows two very similar chunks of activity in the privileged content process. I think the first chunk is for rendering the new tab page that's shown in the foreground tab, and the second chunk is for preparing another new tab page in the background.

Here's a profile with many repeats: https://share.firefox.dev/4fPcrdF

We triaged this bug in a triage meeting and agreed that this continues to stay medium impact.

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