Closed Bug 1752853 Opened 2 years ago Closed 2 years ago

Stop using a worker to write session restore information

Categories

(Firefox :: Session Restore, task, P3)

Desktop
All
task

Tracking

()

RESOLVED FIXED
100 Branch
Performance Impact medium
Tracking Status
firefox100 --- fixed

People

(Reporter: Gijs, Assigned: mathew.hodson)

References

(Blocks 1 open bug)

Details

(Keywords: perf, perf:frontend, perf:startup)

Attachments

(1 file)

Writes to session restore currently happen from SessionWorker.js, which is loaded as a worker from SessionWorker.jsm.

After bug 1649605, the worker is using IOUtils to write async (ie it's not writing on the worker thread, but on a background thread).

It also has a mechanism to ensure only 1 pending IOUtils operation is happening at a given time.

At this point, given we don't do the writes on the worker thread, the worker is just overhead. That overhead manifests itself as time spent serializing to post to the worker, then deserializing, then serializing to JSON again, to finally do the write.

That means we could reduce the serialization overhead by a factor 3 by just getting rid of the worker. We should be able to fold the SessionWorker.js stuff into SessionWorker.jsm pretty straightforwardly, and then maybe rename to SessionWriter or similar to avoid confusion. This will also get rid of any startup costs associated with creating a DOM worker to do the write IO. We could in future perhaps enable more optimization if we could somehow memcpy or w/e the JS object writeJSON gets passed and do the serialization off-mainthread, but this would be a nice start...

This seems like a juicy opportunity. I agree that finding a way of transferring the JS object to the IOUtils thread rather than doing the serialization/deserialization, would be really really nice - would help us side step bug 1546847.

Whiteboard: [fxperf] → [fxperf:p2]
Assignee: nobody → mathew.hodson
Attachment #9262501 - Attachment description: WIP: Bug 1752853 - Stop using a worker to write session store. r?Gijs → Bug 1752853 - Stop using a worker to write session store. r?Gijs
Status: NEW → ASSIGNED

The severity field is not set for this bug.
:dao, could you have a look please?

For more information, please visit auto_nag documentation.

Flags: needinfo?(dao+bmo)
Pushed by mbanner@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2a8633af0279
Stop using a worker to write session store. r=Gijs,Standard8
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
Regressions: 1761652
Regressions: 1761576
Blocks: 964531
Severity: -- → S3
Performance Impact: --- → P2
Flags: needinfo?(dao+bmo)
Priority: -- → P3
Whiteboard: [fxperf:p2]
Blocks: 1546847
Type: defect → task
No longer regressions: 1761576
See Also: → 1761576
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: