Open Bug 1519204 Opened 5 years ago Updated 2 years ago

Meta - Improve scheduling in Firefox to address page-load and other performance issues

Categories

(Firefox :: General, enhancement, P3)

enhancement

Tracking

()

People

(Reporter: djvj, Unassigned)

References

Details

An investigation revealed that the primary component of Firefox's poor performance (and perceived performance) at loading pages is the way in which Firefox schedules different pieces of work.

Significantly, Javascript execution that could be delayed until after painting (i.e. user-visible activity) is instead eagerly executed. This behaviour differs from Chrome in that Chrome is more aggressive about scheduling user-impactful activities (mainly page rendering) aggressively in front of JS execution, leading to much faster actual page-load times from the user's perspective.

This class of scheduling relates to the ordering of execution of Javascript from <script> tags on pages, as well as from setTimeout calls.. with respect to paints.

Yet another class of scheduling issues arises from the uncoordinated use of background threads by various components (graphics subsystem, javascript engine, stylo). Each component treats these threads as magical "off main thread" targets which doesn't take into account the fact that they all run on the same computer, among a common set of CPU cores. On mobile systems, this set of CPU cores may be very small (i.e. 1). This leads to a situation where Firefox abdicates work scheduling of this sort to the OS, which has no concept of how to prioritize various events.

Both "event scheduling" (problem 1) and "off-main-thread job scheduling" (problem 2) relate more generally to the lack of a general scheduler in Firefox.

This meta-bug exists to track work that addresses scheduling-related issues of either sort, and any work related to the creation of a coherent browser scheduler that intelligently prioritizes and dispatches across all types of events.

Bas made a bunch of testcases which demonstrate some of the page-load performance issues that occur due to this. As of Jan 10, 2019, he wrote: "Our behavior is identical to chrome for externallate and externaltimeout5000, everywhere else, we're worse."

https://faraday.basschouten.com/mozilla/executionorder/

Depends on: 1514011, 1488863
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.