Bug 62837 - [chromium]Optimize GraphicsLayerChromium::setChildren
Summary: [chromium]Optimize GraphicsLayerChromium::setChildren
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-16 18:13 PDT by zeng huiqing
Modified: 2011-06-28 18:15 PDT (History)
9 users (show)

See Also:


Attachments
Proposed patch (2.73 KB, patch)
2011-06-17 00:27 PDT, zeng huiqing
no flags Details | Formatted Diff | Diff
Proposed patch (2.74 KB, patch)
2011-06-17 00:43 PDT, zeng huiqing
no flags Details | Formatted Diff | Diff
Proposed patch (2.74 KB, patch)
2011-06-17 00:52 PDT, zeng huiqing
kbr: review-
Details | Formatted Diff | Diff
new patch (2.75 KB, patch)
2011-06-27 21:53 PDT, zeng huiqing
no flags Details | Formatted Diff | Diff
new patch (3.35 KB, patch)
2011-06-27 23:32 PDT, zeng huiqing
no flags Details | Formatted Diff | Diff
newPatch (2.81 KB, patch)
2011-06-27 23:56 PDT, zeng huiqing
kbr: review-
Details | Formatted Diff | Diff
newPatch (2.77 KB, text/plain)
2011-06-28 16:21 PDT, zeng huiqing
no flags Details
newPatch (2.77 KB, patch)
2011-06-28 16:24 PDT, zeng huiqing
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zeng huiqing 2011-06-16 18:13:49 PDT
The GraphicsLayerChromium::setChildren will call GraphicsLayer::setChildren, and it will call addChild() for each child, which will end up calling updateChildList() N times. This is potentially(N^2).
Comment 1 zeng huiqing 2011-06-17 00:27:40 PDT
Created attachment 97552 [details]
Proposed patch
Comment 2 WebKit Review Bot 2011-06-17 00:30:43 PDT
Attachment 97552 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebCore/ChangeLog:6:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 zeng huiqing 2011-06-17 00:43:31 PDT
Created attachment 97554 [details]
Proposed patch
Comment 4 zeng huiqing 2011-06-17 00:52:33 PDT
Created attachment 97556 [details]
Proposed patch
Comment 5 zeng huiqing 2011-06-23 01:35:53 PDT
For page load performance test, we find that while load a page that has 3D CSS transformation property, disable h/w accleration is 2x of enable h/w acceleration on chromium both on Linux and Win7.

Through analysis, we find the root cause is that with hardware acceleration enabled, when update the compositingLayers, the
GraphicsLayerChromium::setChildren will call GraphicsLayer::setChildren, and it will call addChild() for each child, which will end up calling updateChildList() N times. This is potentially(N^2).

The patch is to add an flag(m_setChildren)in class 'GraphicsLayerChromium' to avoid the unnecessary call, and the gap between disable h/w and enable h/w becomes < 10%.
Comment 6 Eric Seidel (no email) 2011-06-23 20:17:24 PDT
I assume this is only a problem for Chromium and not other platforms?
Comment 7 Simon Fraser (smfr) 2011-06-23 20:26:42 PDT
Yeah. We used to have this issue on Windows/CA, but now share code with Mac.
Comment 8 zeng huiqing 2011-06-23 21:56:20 PDT
Have checked that qt&gtk also don't have this issue.
Comment 9 Vangelis Kokkevis 2011-06-27 10:30:29 PDT
Comment on attachment 97556 [details]
Proposed patch

View in context: https://bugs.webkit.org/attachment.cgi?id=97556&action=review

Thanks for the patch! This solution will fix the problem.  I do think that the GraphicsLayerChromium child management code needs some clean up and batching up pushes to the platform layers much like the CA implementation does would be nice.  However, I think this is a good intermediate solution.

> Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:133
> +    m_setChildren = true;

Maybe using m_inSetChildren (instead of m_setChildren) would be more descriptive?

> Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:135
>      // FIXME: GraphicsLayer::setChildren calls addChild() for each child, which

This fixme should be removed now.
Comment 10 Kenneth Russell 2011-06-27 10:55:56 PDT
Comment on attachment 97556 [details]
Proposed patch

Per Vangelis' review, it looks like this is close to being ready to land. Please submit a revised one and I'll gladly r+ it. (Also, please set the r? and cq? bits on the new patch.)
Comment 11 zeng huiqing 2011-06-27 21:53:15 PDT
Created attachment 98856 [details]
new patch

update the old patch according to Vangelis's comments
Comment 12 Vangelis Kokkevis 2011-06-27 23:06:00 PDT
Comment on attachment 98856 [details]
new patch

View in context: https://bugs.webkit.org/attachment.cgi?id=98856&action=review

one additional comments.. Otherwise looks good!

> Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:98
> +    m_inSetChildren = false;

This should move up to the initializer list.
Comment 13 zeng huiqing 2011-06-27 23:32:32 PDT
Created attachment 98864 [details]
new patch

update the patch: move the "m_inSetChildren = false" to initializer list.
Comment 14 Vangelis Kokkevis 2011-06-27 23:38:08 PDT
Comment on attachment 98864 [details]
new patch

View in context: https://bugs.webkit.org/attachment.cgi?id=98864&action=review

> Source/WebCore/ChangeLog:16
> +2011-06-27  Zeng Huiqing  <huiqing.zeng@intel.com>

Double changelog entry...
Comment 15 zeng huiqing 2011-06-27 23:56:40 PDT
Created attachment 98867 [details]
newPatch

sorry for the double changelog entry, have removed it.
Comment 16 Kenneth Russell 2011-06-28 10:58:51 PDT
Comment on attachment 98867 [details]
newPatch

View in context: https://bugs.webkit.org/attachment.cgi?id=98867&action=review

> Source/WebCore/platform/graphics/chromium/GraphicsLayerChromium.cpp:136
>      // FIXME: GraphicsLayer::setChildren calls addChild() for each child, which
>      // will end up calling updateChildList() N times.

You forgot to remove this FIXME.
Comment 17 zeng huiqing 2011-06-28 16:21:48 PDT
Created attachment 98994 [details]
newPatch
Comment 18 zeng huiqing 2011-06-28 16:24:45 PDT
Created attachment 98996 [details]
newPatch 

new patch: remove the 'FIXME'
Comment 19 Kenneth Russell 2011-06-28 16:32:40 PDT
Comment on attachment 98996 [details]
newPatch 

Thanks, this last version looks good. r=me
Comment 20 WebKit Review Bot 2011-06-28 17:57:36 PDT
Comment on attachment 98996 [details]
newPatch 

Clearing flags on attachment: 98996

Committed r89980: <http://trac.webkit.org/changeset/89980>
Comment 21 WebKit Review Bot 2011-06-28 17:57:42 PDT
All reviewed patches have been landed.  Closing bug.
Comment 22 zeng huiqing 2011-06-28 18:15:07 PDT
Thanks for the review.