Improve performance for printing when multiple shadow roots share adopted style sheets
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox76 | --- | fixed |
People
(Reporter: nordzilla, Assigned: nordzilla)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
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.
Assignee | ||
Comment 1•5 years ago
|
||
Comment 3•5 years ago
|
||
bugherder |
Description
•