Closed Bug 1514011 Opened 6 years ago Closed 2 years ago

Investigate script execution order and also possibly yield if there is pending vsync.

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
Performance Impact high

People

(Reporter: smaug, Unassigned)

References

(Depends on 1 open bug, Blocks 2 open bugs)

Details

(Keywords: perf:pageload)

Attachments

(1 file, 1 obsolete file)

for yielding we may need something new in nsIThread, something which ends up checking just the high priority queue in https://searchfox.org/mozilla-central/rev/fd32b3a6fa3eff1468311f6fcf32b45c117136df/xpcom/threads/PrioritizedEventQueue.cpp#256
Priority: -- → P3
Whiteboard: [qf]
Whiteboard: [qf] → [qfp1:pageload]
Whiteboard: [qfp1:pageload] → [qf:p1:pageload]
Bas, can you investigate?
Assignee: nobody → bas
Changing the title a bit, since the same could be possible done to non async/defer too.
Summary: Investigate async and defer script execution order and also possibly yield if there is pending vsync → Investigate script execution order and also possibly yield if there is pending vsync.
There might not be need to add anything for nsIThread to check high prio queue, but https://searchfox.org/mozilla-central/rev/fef7f858efb695a76010b4c624da5277c16e95b3/layout/base/nsRefreshDriver.h#399-410 could be possibly used too.
Depends on: 1518038
Blocks: 1519204
Attached patch yield_script.diff (WIP) (obsolete) (deleted) — Splinter Review

Just a simple idea I had for this. No idea how it behaves (but locally it seems to kick in quite often when loading espn.com).

tests: https://treeherder.mozilla.org/#/jobs?repo=try&revision=53b9b014d5f61a35ed2c07ff6a5a90f1c0e45927
raptor: https://treeherder.mozilla.org/#/jobs?repo=try&revision=7c36a19b59f8ca4a289eeb3ca213ca3c790a9da6

oh, that is massively orange on try :/
Testing a variant then.

Component: DOM → DOM: Core & HTML

bas, you had some tests showing the issues around script execution and painting.

Flags: needinfo?(bas)

https://faraday.basschouten.com/mozilla/executionorder/allinlinedual.html still shows a considerably difference between Fx and Chrome :).

Flags: needinfo?(bas)

Hi Olli, this feels kind of stalled. Do we have any idea how to move forward here?

Flags: needinfo?(bugs)

I guess this is more something that the performance team may take a look at.

Flags: needinfo?(bugs)

Fixing this is at least partially dependent on network requests being able to be started while the main thread is blocked.

See: https://docs.google.com/document/d/10CWyblMi1ZKDNnf1AOYficzfiKdZuL1erqSpG58gCpk/edit#

After that we can see if more work is needed to ensure paints are done when possible.

Assignee: bas → nobody
Performance Impact: --- → P1
Keywords: perf:pageload
Whiteboard: [qf:p1:pageload]

(In reply to Bas Schouten (:bas.schouten) from comment #13)

Fixing this is at least partially dependent on network requests being able to be started while the main thread is blocked.

See: https://docs.google.com/document/d/10CWyblMi1ZKDNnf1AOYficzfiKdZuL1erqSpG58gCpk/edit#

After that we can see if more work is needed to ensure paints are done when possible.

Setting dependency according to this comment.

Depends on: omt-networking

We believe this is partially fixed, and Chrome's behavior has also changed to be more like ours. Closing for now.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: