Open Bug 1515414 Opened 7 years ago Updated 3 years ago

Defer GCs in background tabs/processes during pageload

Categories

(Core :: JavaScript: GC, enhancement, P3)

58 Branch
enhancement

Tracking

()

Performance Impact medium

People

(Reporter: jesup, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: perf, perf:pageload)

Similar to bug 963477, we should consider deferring GC/CC during pageload, if they're occurring or would be scheduled during that time. The deferment can't be absolute, but we could abort current GCs, and defer most GCs (or be more careful they only occur when all processes are idle). This may (likely would) be dependent on a to-be-designed cross-process state/activity status/task-scheduler. This is also likely to be more important (especially the cross-process aspect) with Fission. Any GC allowed to run during this time may want to have a smaller-than-normal target time allocation. This case is particularly important for actions like Switch Tab (which likely will cause a compacting GC to run "soon"), followed quickly by click-link (or if the tab switched to is a new tab, or a previously not-loaded tab).
This can probably be handled today by listening to all RemoteWebProgressManager objects (perhaps adding call directly from RemoteWebProcessManager._callProgressListeners), which increments/decrements a global numLoadingDocuments variable. When this changes 0 => 1 or 1 => 0, we would then broadcast that fact to child processes. https://searchfox.org/mozilla-central/rev/2e5e28f518524f8af5b158ddb605022b6a2d68cf/toolkit/modules/RemoteWebProgress.jsm#150 There might also have to be some handling for tabs closing / crashing.
Whiteboard: [qf] → [qf:p1:pageload]
Priority: -- → P3

We have now cross process idle scheduling which knows when foremost tab is loading and doesn't let background processes to use idle time as much when load is happening. So this is probably p2 now. We can change that once we measure Fission page load.

Whiteboard: [qf:p1:pageload] → [qf:p2:pageload]

Mass-removing myself from cc; search for 12b9dfe4-ece3-40dc-8d23-60e179f64ac1 or any reasonable part thereof, to mass-delete these notifications (and sorry!)

Performance Impact: --- → P2
Keywords: perf:pageload
Whiteboard: [qf:p2:pageload]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.