Leaf non self-painting layers should bail out early in RenderLayer::paintLayer
authorjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 May 2012 02:17:15 +0000 (02:17 +0000)
committerjchaffraix@webkit.org <jchaffraix@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 5 May 2012 02:17:15 +0000 (02:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85678

Reviewed by Darin Adler.

Performance optimization, no expected change in behavior.

The gist of the change is that leaf non self-painting layers don't need to be painted as their
associated RenderBoxModelObject should properly paint itself without any help.

For RenderLayer trees that have a large number of leafs nodes (like a table with a leaf RenderLayer for
each cells), not bailing out is a big overhead as it ends up doing a lot of computation for no real
painting. See http://dglazkov.github.com/performance-tests/biggrid.html for a benchmark for that. On
my machine, it reduces the paint time when scrolling to 70ms from 120ms (45% speedup).

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintLayer):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@116203 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index f640463f56e421d5feb95ab6766b47dc4e4d90af..fc5c0721d5cf43fdad9ae2b8a72b71c8b5e2d77e 100644 (file)
@@ -1,3 +1,23 @@
+2012-05-04  Julien Chaffraix  <jchaffraix@webkit.org>
+
+        Leaf non self-painting layers should bail out early in RenderLayer::paintLayer
+        https://bugs.webkit.org/show_bug.cgi?id=85678
+
+        Reviewed by Darin Adler.
+
+        Performance optimization, no expected change in behavior.
+
+        The gist of the change is that leaf non self-painting layers don't need to be painted as their
+        associated RenderBoxModelObject should properly paint itself without any help.
+
+        For RenderLayer trees that have a large number of leafs nodes (like a table with a leaf RenderLayer for
+        each cells), not bailing out is a big overhead as it ends up doing a lot of computation for no real
+        painting. See http://dglazkov.github.com/performance-tests/biggrid.html for a benchmark for that. On
+        my machine, it reduces the paint time when scrolling to 70ms from 120ms (45% speedup).
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintLayer):
+
 2012-05-04  Rob Buis  <rbuis@rim.com>
 
         Remove InlineBox::next()
index 4ef4a067cfb4a68bb568ee8138f70b3eedfe9c40..33379cf2483b72e787507d1ebe19453af3a0ad20 100644 (file)
@@ -2900,6 +2900,10 @@ void RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* context,
     if (!renderer()->opacity())
         return;
 
+    // Non self-painting leaf layers don't need to be painted as their renderer() should properly paint itself.
+    if (!isSelfPaintingLayer() && !firstChild())
+        return;
+
     if (paintsWithTransparency(paintBehavior))
         paintFlags |= PaintLayerHaveTransparency;