Closed Bug 2091121 Opened 18 days ago Closed 6 days ago

Inline microtasks mean copying is noticible now

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
163 Branch
Tracking Status
firefox163 --- fixed

People

(Reporter: mgaudet, Assigned: mgaudet)

References

(Blocks 1 open bug)

Details

Attachments

(3 external files)

Since we have the inline microtask system, now copying is noticeable in some performance profiles. We can fix this by reducing the amount of copying we do through some gentle restructuring of APIs

Avoid copying the now 7-word JS::MicroTask through temporaries when dequeuing
or peeking.

Add forms of JS::DequeueNextMicroTask, DequeueNextRegularMicroTask,
DequeueNextDebuggerMicroTask and PeekNextMicroTask that take a MutableHandle to
fill in place, and use them in the shell's job queue. The value-returning forms
remain until Gecko is converted.

The batching drain loop copied each task through two temporaries on every
dequeue (into a MustConsumeMicroTask, then move-assigning that into the rooted
slot) and two on every peek. WontConsumeMicroTask has no move assignment, so
the RootedField initialization was a copy.

Make Gecko's DequeueNext*MicroTask and PeekNextMicroTask fill a rooted
MustConsumeMicroTask or WontConsumeMicroTask through a MutableHandle getter for
its task storage, so the only copy left is the one out of the queue element.

All callers now fill rooted storage in place, so the forms that copy the task
out are unused.

Assignee: nobody → mgaudet
Attachment #9678204 - Attachment description: WIP: Bug 2091121 - Dequeue and peek microtasks into caller-rooted storage. r?#spidermonkey-reviewers → Bug 2091121 - Dequeue and peek microtasks into caller-rooted storage. r?#spidermonkey-reviewers
Status: NEW → ASSIGNED
Attachment #9678205 - Attachment description: WIP: Bug 2091121 - Fill Gecko's rooted microtasks in place. r?#dom-core → Bug 2091121 - Fill Gecko's rooted microtasks in place. r?#dom-core
Attachment #9678206 - Attachment description: WIP: Bug 2091121 - Remove the value-returning microtask dequeue and peek functions. r?#spidermonkey-reviewers → Bug 2091121 - Remove the value-returning microtask dequeue and peek functions. r?#spidermonkey-reviewers
Severity: -- → N/A
Priority: -- → P1
Pushed by mgaudet@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/d9591eccc9ee https://hg.mozilla.org/integration/autoland/rev/65ed80d5ffc6 Dequeue and peek microtasks into caller-rooted storage. r=spidermonkey-reviewers,dminor https://github.com/mozilla-firefox/firefox/commit/e100282e7b13 https://hg.mozilla.org/integration/autoland/rev/f4a46007289e Fill Gecko's rooted microtasks in place. r=dom-core-reviewers,hsivonen https://github.com/mozilla-firefox/firefox/commit/5b217a524c6c https://hg.mozilla.org/integration/autoland/rev/f58cacb33ecb Remove the value-returning microtask dequeue and peek functions. r=spidermonkey-reviewers,dminor
Status: ASSIGNED → RESOLVED
Closed: 6 days ago
Resolution: --- → FIXED
Target Milestone: --- → 163 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: