avoid quadratic case when appending style sheets
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox137 | --- | fixed |
People
(Reporter: tnikkel, Assigned: tnikkel)
References
(Blocks 1 open bug)
Details
(Keywords: perf-alert, Whiteboard: [sp3])
Attachments
(2 files)
Bug 1931789. Change DocumentOrShadowRoot::StyleOrderIndexOfSheet to return size_t. r?smaug,#dom-core
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
Assignee | ||
Comment 1•9 months ago
|
||
size_t is the return type of nsTArray::IndexOf. NoIndex is defined as (size_t)-1. Implicitly converting this to int32_t which is signed and might be a different bit width seems sketchy to me. This makes this clear and explicit.
Assignee | ||
Comment 2•9 months ago
|
||
FillStyleSetDocumentSheets specifically iterates the existing sheets in reverse order when calling AddDocStyleSheet in order to avoid this problem (because FindDocStyleSheetInsertionPoint iterates from the start of existing sheets).
FindDocStyleSheetInsertionPoint has to deal with some other types of sheets, so just flipping the order it iterates seems a bit more complex.
The slow case that we want to avoid here is the other caller of AddDocStyleSheet: AddStyleSheetToStyleSets. When the sheets are appended at the end one by one using this function we hit the quadratic worst case.
This is about 0.75% of the full sp3 suite.
Updated•8 months ago
|
Updated•8 months ago
|
Comment 4•6 months ago
|
||
I had a totally busted wip that I plan to clean up and land.
Comment 5•6 months ago
|
||
It was of course a silly off-by-one.
Updated•6 months ago
|
Comment 6•6 months ago
|
||
Comment 7•6 months ago
|
||
Comment 8•6 months ago
•
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #6)
So basically no changes to sp3? I was looking also at the other platforms.
Comment 9•6 months ago
|
||
I wonder, was 0.75% covering also the time outside the time which sp3 runner uses for the results?
Assignee | ||
Comment 10•6 months ago
|
||
(In reply to Olli Pettay [:smaug][bugs@pettay.fi] from comment #9)
I wonder, was 0.75% covering also the time outside the time which sp3 runner uses for the results?
Yes. We figured out that was the case on matrix, I never updated this bug with that information. (Which is why I haven't had time to come back to fix the review comments here.)
Comment 12•6 months ago
|
||
Oh sure, I wasn't saying this isn't good :) This stuff does indeed show up in the profiles when not filtering out the not-measured parts of sp3.
Assignee | ||
Comment 13•6 months ago
|
||
Yeah, still worth it to do, just not as important as if it were on some critical paths for common interactive web operations.
Comment 15•6 months ago
|
||
Comment 16•6 months ago
|
||
Comment 17•6 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a1695c424bbd
https://hg.mozilla.org/mozilla-central/rev/8a1c41b85d1c
https://hg.mozilla.org/mozilla-central/rev/923fc29a2667
Comment 18•6 months ago
|
||
(In reply to Norisz Fay [:noriszfay] from comment #17)
https://hg.mozilla.org/mozilla-central/rev/a1695c424bbd
https://hg.mozilla.org/mozilla-central/rev/8a1c41b85d1c
https://hg.mozilla.org/mozilla-central/rev/923fc29a2667
Perfherder has detected a browsertime performance change from push 8a1c41b85d1ce6a77c2abc7c0df2af5ea4f3557a.
Improvements:
Ratio | Test | Platform | Options | Absolute values (old vs new) | Performance Profiles |
---|---|---|---|---|---|
8% | speedometer3 cpuTime | macosx1400-64-shippable-qr | fission webrender | 48,010.34 -> 43,978.17 | Before/After |
3% | speedometer3 TodoMVC-Lit-Complex-DOM/DeletingAllItems/Async | macosx1400-64-shippable-qr | fission webrender | 1.87 -> 1.82 | Before/After |
Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.
If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a sheriff to do that for you.
You can run these tests on try with ./mach try perf --alert 44206
For more information on performance sheriffing please see our FAQ.
Description
•