Closed Bug 1385896 Opened 7 years ago Closed 7 years ago

stylo: Move nsStyleContext::mParent to GeckoStyleContext.

Categories

(Core :: CSS Parsing and Computation, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox-esr52 --- unaffected
firefox55 --- wontfix
firefox56 --- wontfix
firefox57 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(2 files, 1 obsolete file)

Should be doable now, and will unblock bug 1368290.
I was meant to post this a fair while ago, and missed it, whoops. TL;DR: This needs to remove the "don't do change hints for unknown structs". We can't implement it _right now_.

We could implement it with a weak pointer once bug 1368290, but if we remove it we can also clean up a fair amount of code, so I'd like to properly measure whether it's useful today. In any case this is ready for review, we can re-introduce that optimization in bug 1368290 if we think it's useful.we
Attached file Patch to measure the optimization. (obsolete) —
This is the patch I've used to measure the "preserve hints" optimization.

From my testing in a normal browsing session, it has so far helped avoid a few "Repaint" hints, mostly (and I suspect these would be clobbered by more concrete repaints in ancestors or descendants, since they were definitely visual changes).

On youtube, it also helps avoid some UpdateParentOverflow and RecomputePosition hints.

I need to split it, also, between hints on reset and inherited structs, since keeping the optimization working on reset structs is trivial without the parent pointer.
I used this patch to distinguish reset and inherit hints, and most of the hints (and the "strongest" ones) we avoid are from reset structs.

Still it's not too frequent to hit the optimization, but on Twitter, Github and Youtube this still gives us most of the hits, and the most important ones, actually. We'd only lose the optimization for a few NeutralChanges (which don't matter, really), and very sporadically a few RepaintFrames, which as I told above I think they're really subsumed anyway.

Cam, do you think it's reasonable to keep the optimization only for reset structs? This would allow to keep it working in most and the most important cases, and still avoid the weak parent pointer from the text style to the parent, and allow simplifying a lot of the code.
Attachment #8892367 - Attachment is obsolete: true
Flags: needinfo?(cam)
Thanks for doing the checking.  I haven't looked at the patch in detail yet.  Why is it that the lack of parent pointer makes it harder to do this optimization, and why is it that it's easier for reset structs?
Flags: needinfo?(cam) → needinfo?(emilio+bugs)
Basically because we need this hack for text styles right now. And that effectively only affects inherit structs.

http://searchfox.org/mozilla-central/rev/bbc1c59e460a27b20929b56489e2e55438de81fa/layout/style/nsStyleContextInlines.h#125
Flags: needinfo?(emilio+bugs)
Priority: -- → P1
Comment on attachment 8892291 [details]
Bug 1385896: Move nsStyleContext::mParent to GeckoStyleContext.

https://reviewboard.mozilla.org/r/163238/#review169616

::: layout/style/GeckoStyleContext.cpp:648
(Diff revision 1)
>    // Here we set up various style bits for both the Gecko and Servo paths.
>    // _Only_ change the bits here.  For fixups of the computed values, you can
>    // add to ApplyStyleFixups in Gecko and StyleAdjuster as part of Servo's
>    // cascade.

Please update this comment now that we don't call it for Servo contexts.

::: layout/style/nsStyleContext.cpp:91
(Diff revision 1)
> -  if (auto gecko = GetAsGecko())
> -    gecko->RemoveChild(aChild->AsGecko());
> -}
> -
> -void
>  nsStyleContext::FinishConstruction()

Please remove this unused function, although we probably want to preserve the static assertions it's doing.

::: layout/style/nsStyleContext.cpp:183
(Diff revision 1)
>    // Servo's optimization to stop the cascade when there are no style changes
>    // that children need to be recascade for relies on comparing all of the
>    // structs, not just those that are returned from PeekStyleData, although
>    // if PeekStyleData does return null we still don't want to accumulate
>    // any change hints for those structs.

Please update this comment to point out that we're no longer doing this "still don't accumulate any change hints" thing, and why.  (And maybe that we can re-add the optimization for reset structs in a later patch?)
Attachment #8892291 - Flags: review?(cam) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/db88d543de14
Move nsStyleContext::mParent to GeckoStyleContext. r=heycam
See Also: → 1387120
https://hg.mozilla.org/mozilla-central/rev/db88d543de14
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: