Bug 101540 - Attached vs detached tree performance
Summary: Attached vs detached tree performance
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-11-07 19:40 PST by Philip Rogers
Modified: 2012-11-08 14:30 PST (History)
2 users (show)

See Also:


Attachments
Testcase showing performance badness (1.40 KB, text/html)
2012-11-07 19:40 PST, Philip Rogers
no flags Details
Profile (1.15 MB, image/png)
2012-11-07 19:41 PST, Philip Rogers
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Rogers 2012-11-07 19:40:34 PST
Created attachment 172919 [details]
Testcase showing performance badness

In the attached repro, appending a bunch of nodes to a detached element is much slower than appending a bunch of nodes to an attached element. I did a quick trace of this and it looks like the time is spent in walking the render tree (ComposedShadowTreeWalker::traverseSiblingOrBackToInsertionPoint), which doesn't seem right.

We may have some easy performance wins here.

I've attached a screenshot of the trace comparison as well (left: not detached, right: detached).

Original bug:
http://code.google.com/p/chromium/issues/detail?id=155907
Comment 1 Philip Rogers 2012-11-07 19:41:00 PST
Created attachment 172920 [details]
Profile
Comment 2 Philip Rogers 2012-11-07 19:42:23 PST
Additional details from the original bug:
"In particular, I would have expected the non-detach mode to be much slower if I did anything to invalidate layout, and I would have expected the slowdown to be in layout. As expected, both approaches spend the same amount of time in JS as well as in layout. Unexpectedly, adding the nodes while the elements are attached causes one very long style recalc before layout and paint."