Executing DOM worker scripts is delayed by main thread availability
Categories
(Core :: DOM: Workers, enhancement, P3)
Tracking
()
People
(Reporter: bas.schouten, Unassigned)
References
Details
We wait until onStopRequest is executed before we deliver scripts for DOM workers to their execution threads. Because of this execution can be delayed quite significantly, this impacts the Monaco-Editor benchmark for example, a profile showing this can be found here: https://share.firefox.dev/3W1MTPk
Assuming moving onStopRequest off the content process main thread (https://mozilla-hub.atlassian.net/browse/FFXP-2060) will not be done in time for Speedometer 3 release we should consider alternative approaches for parsing and executing the script before the onStopRequest callback is processed on the main thread.
Comment 1•3 years ago
|
||
We can't execute anything before OnStopRequest, since that is when we know the script has been loaded.
Incremental parsing depends on whether JS supports that.
Reporter | ||
Updated•3 years ago
|
Reporter | ||
Comment 2•3 years ago
•
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #1)
We can't execute anything before OnStopRequest, since that is when we know the script has been loaded.
Incremental parsing depends on whether JS supports that.
We just need something to tell us all the bytes of the file are in. OnStopRequest could be that thing but it could be anything if OnStopRequest has some main thread dependency. Signalling just the end of the document does not have a main thread dependency afaict.
But if there's traffic to the main thread for other reasons as well, the PFetch protocol sound like a good solution.
Comment 3•3 years ago
|
||
Anyhow, bug 1351231 should fix this for workers, or at least with that work we can change script loading to not be blocked.
Updated•3 years ago
|
Comment 4•2 years ago
|
||
Bas, could you try to get a new profile? Bug 1351231 has landed on Nightly.
And I'm having trouble to get now a profile where a worker would spend too much time with Monaco-Editor.
Comment 5•2 years ago
|
||
Here is a new profile captured today with a current local mozilla-central build: https://share.firefox.dev/3I1cqmo
Comment 6•2 years ago
|
||
Eden, script loading is still blocked by the main thread? https://share.firefox.dev/3IoHazc
Comment 7•2 years ago
|
||
P3/S3, but this is tracked also as a speedometer3 blocker.
Comment 8•2 years ago
|
||
Yes, I think script loading is still blocked by the main thread. Currently, PFetch only supports fetch() in the worker. But it is not too hard to support PFetch on worker script loading to make it off-main thread.
Updated•2 years ago
|
Updated•2 years ago
|
Comment 9•2 years ago
|
||
Monaco-editor is not part of the sp3
Updated•2 years ago
|
Description
•