Bug 82681 - NodeRareData::m_treeScope should be lazily retrieved
Summary: NodeRareData::m_treeScope should be lazily retrieved
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Hajime Morrita
URL:
Keywords:
Depends on: 82701
Blocks: 87034
  Show dependency treegraph
 
Reported: 2012-03-29 17:28 PDT by Hajime Morrita
Modified: 2013-01-10 09:09 PST (History)
4 users (show)

See Also:


Attachments
WIP (25.64 KB, patch)
2012-03-30 00:27 PDT, Hajime Morrita
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hajime Morrita 2012-03-29 17:28:30 PDT
Currently we set it when a node is inserted into a tree.
But it lets all nodes behind shadow to have NodeRareData. 
That means it no longer "rare". 
In reality, NodeRareData::m_treeScope is a kind of a cash. So we don't maintain it eagerly.

It can be lazily retrieved. This is an alternative of Bug 59816
which aimed to make TreeScope management saner and performant.
Comment 1 Hajime Morrita 2012-03-30 00:27:39 PDT
Created attachment 134738 [details]
WIP
Comment 2 Elliott Sprehn 2012-12-06 09:50:35 PST
Comment on attachment 134738 [details]
WIP

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

> Source/WebCore/dom/Node.cpp:446
> +TreeScope* Node::treeScope(TreeScopeStoreCacheType scoreCache) const

If we took this approach I think you'd need some kind of DirtyTreeScope bit field in node otherwise you're going to cause rare data on every node we call treeScope() on, ex. during event dispatch, and you're also going to introduce this tree walk for treeScope() into all existing pages even ones that don't use Shadow DOM so treeScope gets much slower.
Comment 3 Hajime Morrita 2012-12-06 21:44:56 PST
(In reply to comment #2)
> If we took this approach I think you'd need some kind of DirtyTreeScope bit field in node otherwise you're going to cause rare data on every node we call treeScope() on, ex. during event dispatch, and you're also going to introduce this tree walk for treeScope() into all existing pages even ones that don't use Shadow DOM so treeScope gets much slower.

Yes, this approach looks inferior than replacing document pointer.
We need to inspect each treeScope() call to decide which (slow-clean or fast-caching) we should use.
That isn't what we want. 

This bug was just a result of exploration for attacking slow-treeScope problem.
Comment 4 Dominic Cooney 2013-01-10 06:09:14 PST
Since r138735 m_treeScope is in Node. So I believe this is fixed.
Comment 5 Ryosuke Niwa 2013-01-10 09:09:44 PST
It's probably better to close this with WONTFIX since this bug no longer applies to ToT WebKit.