New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 351140 link

Starred by 2 users

Issue metadata

Status: WontFix
Closed: Mar 2016
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

issue 351146

Sign in to add a comment

Adding elements with ids is too expensive in ShadowRoot

Project Member Reported by, Mar 11 2014

Issue description

Google Chrome	35.0.1870.2 (Official Build 254650) dev
OS	Mac OS X 
Blink	537.36 (@168356)

Polymer apps like to have lots of ShadowRoots, and it's very common to have several ids in each of them since they sugar with this.$.idName in script. Unfortunately this is also causing them pain since a new id HashTable is allocated fresh (and empty) in each new component and then they pay resizing cost (and DocumentOrderedMap::add cost).

Running Time	Self		Symbol Name
757.0ms  100.0%	7.0	 	v8::Function::Call(v8::Handle<v8::Value>, int, v8::Handle<v8::Value>*)
749.0ms   98.9%	8.0	 	 v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, bool*, bool)
741.0ms   97.8%	44.0	 	  v8::internal::Invoke(bool, v8::internal::Handle<v8::internal::JSFunction>, v8::internal::Handle<v8::internal::Object>, int, v8::internal::Handle<v8::internal::Object>*, bool*)
264.0ms   34.8%	3.0	 	   WebCore::ElementV8Internal::createShadowRootMethodCallback(v8::FunctionCallbackInfo<v8::Value> const&)
169.0ms   22.3%	1.0	 	   WebCore::NodeV8Internal::appendChildMethodCallbackForMainWorld(v8::FunctionCallbackInfo<v8::Value> const&)
168.0ms   22.1%	4.0	 	    WebCore::V8Node::appendChildMethodCustom(v8::FunctionCallbackInfo<v8::Value> const&)
129.0ms   17.0%	2.0	 	     WebCore::Node::appendChild(WTF::PassRefPtr<WebCore::Node>, WebCore::ExceptionState&)
119.0ms   15.7%	1.0	 	      WebCore::ContainerNode::appendChild(WTF::PassRefPtr<WebCore::Node>, WebCore::ExceptionState&)
100.0ms   13.2%	0.0	 	       WebCore::ContainerNode::updateTreeAfterInsertion(WebCore::Node&)
87.0ms   11.4%	5.0	 	        WebCore::ChildNodeInsertionNotifier::notify(WebCore::Node&)
80.0ms   10.5%	4.0	 	         WebCore::Element::insertedInto(WebCore::ContainerNode*)
71.0ms    9.3%	2.0	 	          WebCore::Element::updateId(WebCore::TreeScope&, WTF::AtomicString const&, WTF::AtomicString const&)
69.0ms    9.1%	11.0	 	           WebCore::TreeScope::addElementById(WTF::AtomicString const&, WebCore::Element*)
36.0ms    4.7%	1.0	 	            WebCore::DocumentOrderedMap::add(WTF::StringImpl*, WebCore::Element*)
19.0ms    2.5%	18.0	 	            base::(anonymous namespace)::oom_killer_malloc(_malloc_zone_t*, unsigned long)
3.0ms    0.3%	2.0	 	            <Unknown Address>
5.0ms    0.6%	0.0	 	          <Unknown Address>
3.0ms    0.3%	3.0	 	           WebCore::TreeScope::addElementById(WTF::AtomicString const&, WebCore::Element*)
2.0ms    0.2%	2.0	 	           WebCore::Element::shouldRegisterAsExtraNamedItem() const

Benchmark courtesy of sorvell.
1.5 KB View Download
Blocking: chromium:351146
Components: Blink>WebComponents
Labels: -hotlist-toolkit hotlist-Toolkit
Status: Assigned (was: Available)

Comment 4 by, Mar 16 2016

Status: WontFix (was: Assigned)
I ran the test with and without ids, and could not see a significant difference. (and the results were unstable too)

With ids:
x-input: 1150.8150ms
x-input-style: 1847.6650ms
input: 539.8000ms

Without ids:
x-input: 1180.1100ms
x-input-style: 1741.2350ms
input: 535.5350ms

Maybe OILPAN helped this operation to speed up?

Sign in to add a comment