Closed
Bug 1452214
Opened 6 years ago
Closed 5 years ago
https://jrmuizel.github.io/perf-tests/moving-balls.html spends a long time > 110ms in style
Categories
(Core :: CSS Parsing and Computation, defect, P3)
Core
CSS Parsing and Computation
Tracking
()
People
(Reporter: jrmuizel, Assigned: emilio)
References
Details
(Keywords: regression)
Updated•6 years ago
|
Component: CSS Styles → CSS Parsing and Computation
Product: Composer → Core
Version: other → unspecified
Comment 1•6 years ago
|
||
5k elements are traversed and styled, which is exactly expected, but it shouldn't generally take that much time I suppose...
Comment 2•6 years ago
|
||
This is a profile with a single stylo thread: https://perfht.ml/2KD1NXB It seems the majority of time happens in StrongRuleNode::ensure_child. This is a case where one element has tons of children which don't share style at all, so the cost of rule tree becomes significant. We are probably experiencing O(N^2) performance issue here that we are scanning all the child nodes under the parent element for each children. I don't immediately have idea how should this be avoided. Maybe we should exclude rule nodes with only style attribute from rule tree iterating.
Priority: -- → P3
Comment 3•6 years ago
|
||
(In reply to Xidorn Quan [:xidorn] UTC+10 from comment #2) > Maybe we should exclude rule nodes with only style attribute from rule tree iterating. I mean, maybe each rule node can have two subtree, one for rule nodes of style attributes (maybe also animations / transitions?), the other for those from style rules, so that we don't waste time on checking reusability of the former.
Comment 4•6 years ago
|
||
The old nsRuleNode switched its children representation from a linked list to a hash table when we reached a threshold of a certain number of children, which I think would have helped this test. We'd need a lock free way to do that, which isn't impossible, but would complicate the RuleNode implementation even more. Separating style attribute rule nodes out into a separate child list might be reasonable, at the expense of increasing RuleNode's size, though there's probably something clever we could do to avoid that.
Updated•6 years ago
|
Whiteboard: [qf]
Assignee | ||
Comment 5•6 years ago
|
||
It's unclear to me why we spend so much time in ensure_child. That means that the rule node was replaced completely, right? One would think we'd hit[1] often instead. Are we copying the declaration block all the time? If so the bug is in CSSOM I'd think... [1]: https://searchfox.org/mozilla-central/rev/2aa42f2cab4a110edf21dd7281ac23a1ea8901f9/servo/components/style/rule_tree/mod.rs#432
Assignee | ||
Comment 6•6 years ago
|
||
So I'm moderately sure this was regressed by bug 1402218... We still have other bugs related to first-line and such. I think we need to fix the first-line reparenting code instead of that fix, that would allow us to reuse the node. Will take a look when I have the time.
Flags: needinfo?(emilio)
Assignee | ||
Comment 7•6 years ago
|
||
To be clear, the issue here is that we reparent first-line styles even from frames that are about to go away. I'd love to get rid of the first-line reparenting code, but we can presumably do better instead...
Comment 8•6 years ago
|
||
Hey emilio - where do you feel this falls in terms of priority? Given that moving-balls.html is a tech demo, we're not sure how representative it is for the web in general... would you consider this a nice to have (qf:p3), or an important-to-fix (qf:p1)?
Updated•6 years ago
|
Keywords: regression
Assignee | ||
Comment 9•6 years ago
|
||
I'd say it's somewhere in between, p2 probably.
Updated•6 years ago
|
Whiteboard: [qf] → [qf:f64][qf:p3]
Updated•6 years ago
|
Whiteboard: [qf:f64][qf:p3] → [qf:p3:f64]
Updated•6 years ago
|
Whiteboard: [qf:p3:f64] → [qf:p3]
Assignee | ||
Comment 10•5 years ago
|
||
This looks much better now I think. We still thrash the rule tree way more than we should due to ::first-line shittyness, but bug 1493420 should've made it faster. Mind confirming you also don't see such huge style times anymore?
Flags: needinfo?(emilio) → needinfo?(jmuizelaar)
Reporter | ||
Comment 11•5 years ago
|
||
Style is still a big chunk of the time, but it's improved enough for us to mark this as fixed: https://perfht.ml/35HvWQD
Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(jmuizelaar)
Resolution: --- → FIXED
Updated•5 years ago
|
Assignee: nobody → emilio
status-firefox67:
--- → wontfix
status-firefox68:
--- → wontfix
status-firefox69:
--- → fixed
status-firefox-esr60:
--- → wontfix
status-firefox-esr68:
--- → wontfix
Depends on: 1493420
Target Milestone: --- → mozilla69
Updated•2 years ago
|
Performance Impact: --- → P3
Whiteboard: [qf:p3]
Updated•8 months ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•