Closed
Bug 1228877
Opened 9 years ago
Closed 9 years ago
nsStyleContext::HasChildThatUsesGrandancestorStyle is slow
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla45
Tracking | Status | |
---|---|---|
firefox45 | --- | fixed |
People
(Reporter: dbaron, Assigned: dbaron)
Details
(Keywords: perf)
Attachments
(1 file)
I just took a profile in which 5% of the time was in nsStyleContext::HasChildThatUsesGrandancestorStyle . (I was profiling the leaflet-osm-conversion branch of https://github.com/dbaron/timezone-map . I'd definitely expect this to have some elements with very large numbers of different children.) This seems trivial to fix; we should just set the bit on the parent and rename the bit to NS_STYLE_CHILD_USES_GRANDANCESTOR_STYLE
Assignee | ||
Updated•9 years ago
|
Assignee: nobody → dbaron
Assignee | ||
Comment 1•9 years ago
|
||
Assignee | ||
Comment 2•9 years ago
|
||
Comment on attachment 8693379 [details] [diff] [review] Make nsStyleContext::HasChildThatUsesGrandancestorStyle by setting bit on grandchild's parent instead of grandchild I was going to put this in heycam's queue for when he gets back, but given that I can't, I'll ask xidorn to review it...
Attachment #8693379 -
Flags: review?(quanxunzhen)
Comment 3•9 years ago
|
||
Comment on attachment 8693379 [details] [diff] [review] Make nsStyleContext::HasChildThatUsesGrandancestorStyle by setting bit on grandchild's parent instead of grandchild Review of attachment 8693379 [details] [diff] [review]: ----------------------------------------------------------------- Looks like a mostly straightforward refactoring. r=me with some nits below. ::: layout/style/nsRuleNode.cpp @@ +1714,4 @@ > return; > } > > for (;;) { It seems this loop could now be simplified to a tranditional "for" loop to make things more compact and clearer. (And the "if" above could probably be removed as well, so that we don't have two identical assertions.) ::: layout/style/nsStyleContext.h @@ +246,5 @@ > "parent mismatch"); > } > } > > + // Does any child this style context, or any of its descendants, have Does any child *of*. Probably only "Does any of this context's descendants" is enough now.
Attachment #8693379 -
Flags: review?(quanxunzhen) → review+
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to Xidorn Quan [:xidorn] (UTC+10) from comment #3) > It seems this loop could now be simplified to a tranditional "for" loop to > make things more compact and clearer. (And the "if" above could probably be > removed as well, so that we don't have two identical assertions.) Indeed. This also removes the requirement that callers check that the inherited-from context is not the parent, so I removed that condition from the initial assertion, although I didn't adjust either of the callers.
Assignee | ||
Comment 5•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=70ed5feb6d47&group_state=expanded
Assignee | ||
Comment 6•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/4a3c509bcb25a533b0eb161f2c5604962a837c37 Bug 1228877 - Make nsStyleContext::HasChildThatUsesGrandancestorStyle by setting bit on grandchild's parent instead of grandchild. r=xidorn
Comment 7•9 years ago
|
||
sorry had to back this out in https://hg.mozilla.org/integration/mozilla-inbound/rev/196f2f131c70 since something in this push caused https://treeherder.mozilla.org/logviewer.html#?job_id=17983411&repo=mozilla-inbound
Flags: needinfo?(dbaron)
Assignee | ||
Comment 9•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ddaae692ddd9a7427fe18e93334d80a1f49bac96 Bug 1228877 - Make nsStyleContext::HasChildThatUsesGrandancestorStyle by setting bit on grandchild's parent instead of grandchild. r=xidorn
Assignee | ||
Updated•9 years ago
|
Flags: needinfo?(dbaron)
Comment 10•9 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ddaae692ddd9
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Assignee | ||
Comment 11•9 years ago
|
||
Comment on attachment 8693379 [details] [diff] [review] Make nsStyleContext::HasChildThatUsesGrandancestorStyle by setting bit on grandchild's parent instead of grandchild Probably good for heycam to have a look at this now that he's back.
Attachment #8693379 -
Flags: feedback?(cam)
Comment 12•6 years ago
|
||
Comment on attachment 8693379 [details] [diff] [review] Make nsStyleContext::HasChildThatUsesGrandancestorStyle by setting bit on grandchild's parent instead of grandchild I probably should have looked at this earlier, but the code is now gone. :-)
Attachment #8693379 -
Flags: feedback?(cam)
You need to log in
before you can comment on or make changes to this bug.
Description
•