Closed Bug 1622322 Opened 5 years ago Closed 5 years ago

Improve performance for printing when multiple shadow roots share adopted style sheets

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

76 Branch
enhancement

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: nordzilla, Assigned: nordzilla)

References

Details

Attachments

(1 file)

When we print, a static clone of the document is created to act as a snapshot for what should be printed.

During this process, we may end up creating clones of multiple shadow roots that may be sharing the same adopted style sheets with the document itself and potentially other shadow roots.

Right now, if we had 10 shadow roots that all adopted the same 10 style sheets, we would end up creating 100 total cloned style sheets, 10 for each cloned root.

Unfortunately, we do have to clone the sheets themselves, otherwise there would be mutable references to the sheets outside of our "static" snapshot.

However; we can improve the performance by using a hash map during the cloning process, such that if a cloned sheet has already been created, the cloned shadow roots can find it and share the same cloned sheet.

This will reduce the number style sheet clones from 1:N, where N is the number of adopters of the sheet, to 1:1.

Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/1d5ce5b1630d Improve print performance when sheets are adopted multiple times r=emilio
Status: ASSIGNED → RESOLVED
Closed: 5 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: