Closed Bug 1774796 Opened 2 years ago Closed 2 years ago

Implement a new delazification strategy to minimize main-thread effort in case of races.

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
103 Branch
Tracking Status
firefox103 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

As of today, we have only a single delazification strategy which will take functions in the order in which they appear in the source file. However, one might agree that the file order is not representative of the execution of the JavaScript sources.

Instead of focusing on guessing the ordering in which functions are taken, we could take another approach which goal is to minimize the time spent by the main thread at doing any delazification in case of races. Thus, on delazification task, we should prioritized the functions which would be costly to delazify on the main thread.

One simple approximation/heuristic of the complexity of functions is to consider the length of functions, from sourceStart to sourceEnd. Thus, in case of races, the main thread would most likely hit small functions.

This patch adds a new off-thread delazification strategy, which adds a bit of
overhead to queue function with a priority order, which put the largest function
as the first functions to be delazified.

The intent of this new strategy is to limit the usage of main-thread
delazification to the smallest function, in case where the main-thread would win
the delazification race.

Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7ebeb45fe196
Add largest-first delazification strategy. r=arai
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 103 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: