ElementStyle#onRuleUpdated iterate as many time as we have pseudo elements , should only iterator over unique pseudo element types
Categories
(DevTools :: Inspector: Rules, defect, P2)
Tracking
(firefox126 fixed)
Tracking | Status | |
---|---|---|
firefox126 | --- | fixed |
People
(Reporter: nchevobbe, Assigned: nchevobbe)
References
(Blocks 1 open bug)
Details
(Whiteboard: [bhr-onRuleUpdated])
Attachments
(1 file)
onRuleUpdated
loops through a list of pseudo element types that are used in rules https://searchfox.org/mozilla-central/rev/a06d5a8871b1796f2dbd588ab518eaa98507e018/devtools/client/inspector/rules/models/element-style.js#271-281:
onRuleUpdated() {
// Update declarations for matching rules for pseudo-elements.
for (const pseudo of this.pseudoElements) {
this.updateDeclarations(pseudo);
}
}
Unfortunately, that list does not contain unique item, but as many item as pseudo element rules https://searchfox.org/mozilla-central/rev/a06d5a8871b1796f2dbd588ab518eaa98507e018/devtools/client/inspector/rules/models/element-style.js#143-146 :
// Store a list of all pseudo-element types found in the matching rules.
this.pseudoElements = this.rules
.filter(r => r.pseudoElement)
.map(r => r.pseudoElement);
This can be extremely costly when there are a lot of pseudo elements, like in Bug 1410716
We should only loop through unique pseudo element types
Assignee | ||
Comment 1•6 months ago
|
||
Only store unique pseudo element types in this.pseudoElements
, that we also
rename to this.pseudoElementTypes
to be more explicit.
Updated•6 months ago
|
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Updated•6 months ago
|
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/41f296e08233 [devtools] Fix useless and costly iteration over pseudo elements in onRuleUpdated. r=devtools-reviewers,ochameau.
Comment 3•6 months ago
|
||
bugherder |
Assignee | ||
Comment 4•5 months ago
|
||
== Change summary for alert #42072 (as of Sat, 30 Mar 2024 05:55:51 GMT) ==
Improvements:
Ratio | Test | Platform | Options | Absolute values (old vs new) |
---|---|---|---|---|
10% | damp custom.inspector.manyrules.selectnode | windows10-64-shippable-qr | e10s fission stylo webrender-sw | 708.67 -> 637.00 |
9% | damp custom.inspector.manyrules.selectnode | windows10-64-shippable-qr | e10s fission stylo webrender | 704.38 -> 638.02 |
9% | damp custom.inspector.manyrules.selectnode | linux1804-64-shippable-qr | e10s fission stylo webrender-sw | 819.20 -> 742.32 |
9% | damp custom.inspector.manyrules.selectnode | linux1804-64-shippable-qr | e10s fission stylo webrender | 831.07 -> 759.00 |
For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=42072
Description
•