PSA: "Slimming Paint Invalidation" shipping with Chrome 58

146 views
Skip to first unread message

Chris Harrelson

unread,
Jan 23, 2017, 4:21:36 PM1/23/17
to blink-dev, pain...@chromium.org

TL/DR


In M58, the Paint team is planning ship a feature under the runtime flag SlimmingPaintInvalidation. This is one more step on the path to SPv2; call it SP1.5. Web developers should observe no change except fewer bugs.


This code is under the SlimmingPaintInvalidation runtime flag; it can be turned off via about:flags or with --disable-blink-features=SlimmingPaintInvalidation.


Please bear with us during this launch - we have tested it heavily for correctness and performance, but there will as always be bugs and other problems. If you see any paint invalidation bugs after we turn it it on, please *take extra effort to tell us*. We want to fix any and all bugs right away, not after launch.


What is it?


It's a re-implementation of Paint Invalidation to (a) be more correct and performant, and (b) be compatible with the SPv2 design. Some additional flavor is below.


Today, the Blink document lifecycle looks, at a high level, like this:


Style -> Layout -> Compositing -> Paint Invalidation -> Paint


After this launch, it'll be:


Style -> Layout -> Compositing -> Pre-paint -> Paint*


The pre-paint tree walk does two things in parallel:


1. Build paint property trees. Think of them as "sparse versions" of the layout tree which represent the hierarchies of transforms, clips, effects and scrolls in a webpage. Paint property trees are a key data structure for SPv2. SPv2 will replace the current GraphicsLayer tree with paint property trees plus a collection of PaintChunks.


2. Invalidates paint for changed LayoutObjects. This works very similarly to the "Paint Invalidation" tree walk today, but is implemented more cleanly, and has better performance in some cases (such as content below a 2D transform) by using the new GeometryMapper class. It will also reduce the complexity of the LayoutObject class and its sub-classes by removing additional code related to paint invalidation.


(*) The paint code will also use property trees and GeometryMapper for many current use-cases of the PaintLayerClipper class, which will improve performance, move closer to SPv2, and allow us to fix some other long-standing bugs, such as taking full transforms into account for overlap testing.

Thanks,
Chris

Chris Harrelson

unread,
Jun 27, 2017, 1:45:36 PM6/27/17
to blink-dev, pain...@chromium.org, Xianzhu Wang
Hi all,

I am happy to announce that Slimming Paint Invalidation has now shipped in M59!

This launch represents a huge improvement to the reliability and quality of the paint invalidation code in Blink:
 * All paint invalidation code factored of layout/Layout* classes and into paint/*Invalidator (unblocks further Layout refactoring such as LayoutNG)
* Greatly simplified code, removing unnecessary optimization paths and clarifying the semantics of existing ones
* Puts in place Paint Property Trees (these are a key data structure for SPv2)

In addition, our data shows that paint invalidation is faster than the old system in all percentiles, including 10% faster at the 75th percentile (~0.1 -> 0.95ms), and 6% faster at the 95th percentile (~0.54 -> 0.5ms). Certain cases, such as invalidation under 2D transform, is significantly faster. For example, the cost of paint invalidation in the "design" benchmark within MotionMark is greatly improved.

We intend to shortly delete the old code, at a savings of about 1400 lines of code.

Congratulations to the paint team, and in particular Xianzhu Wang, who was the primary driver of this feature.

Chris

Alexandre Elias

unread,
Jun 27, 2017, 4:28:48 PM6/27/17
to Chris Harrelson, blink-dev, pain...@chromium.org, Xianzhu Wang
Congratulations!  I'm always excited to see major milestones in SPv2 launch.  I think data-flow-unifying cleanups like this, aside from immediately improving performance, are one of the most important areas for the long-term health and extensibility of Blink.

--
You received this message because you are subscribed to the Google Groups "paint-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to paint-dev+unsubscribe@chromium.org.
To post to this group, send email to pain...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/paint-dev/CAOMQ%2Bw_6itskO8se6kr1qmEY6kny9Sse7VtbatuJXkRE2HpTzQ%40mail.gmail.com.

Ojan Vafai

unread,
Jun 27, 2017, 5:18:53 PM6/27/17
to Alexandre Elias, Chris Harrelson, blink-dev, pain...@chromium.org, Xianzhu Wang
\o/

To unsubscribe from this group and stop receiving emails from it, send an email to paint-dev+...@chromium.org.

To post to this group, send email to pain...@chromium.org.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CADeTeo62TQ%2B7-bRX_CoBTpdmhs4UiB3Qcim4e%2BhW7T3QtrcMeA%40mail.gmail.com.

Dimitri Glazkov

unread,
Jun 27, 2017, 5:20:18 PM6/27/17
to Ojan Vafai, Alexandre Elias, Chris Harrelson, blink-dev, pain...@chromium.org, Xianzhu Wang

Emil A Eklund

unread,
Jun 27, 2017, 10:46:19 PM6/27/17
to Chris Harrelson, pain...@chromium.org
-blink-dev

This is awesome, congratulations paint team!
\o/
Reply all
Reply to author
Forward
0 new messages