Title: [167589] trunk/Source/WebCore
Revision
167589
Author
[email protected]
Date
2014-04-21 03:15:40 -0700 (Mon, 21 Apr 2014)

Log Message

Micro-optimize the way we hand NodeLists to JSC.
<https://webkit.org/b/131932>

Use HashMap::fastAdd() when returning cached node lists and collections.
10.9% progression on Bindings/get-elements-by-tag-name.html

Reviewed by Antti Koivisto.

* dom/NodeRareData.h:
(WebCore::NodeListsNodeData::addCacheWithAtomicName):
(WebCore::NodeListsNodeData::addCacheWithName):
(WebCore::NodeListsNodeData::addCacheWithQualifiedName):
(WebCore::NodeListsNodeData::addCachedCollection):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (167588 => 167589)


--- trunk/Source/WebCore/ChangeLog	2014-04-21 07:25:05 UTC (rev 167588)
+++ trunk/Source/WebCore/ChangeLog	2014-04-21 10:15:40 UTC (rev 167589)
@@ -1,3 +1,19 @@
+2014-04-21  Andreas Kling  <[email protected]>
+
+        Micro-optimize the way we hand NodeLists to JSC.
+        <https://webkit.org/b/131932>
+
+        Use HashMap::fastAdd() when returning cached node lists and collections.
+        10.9% progression on Bindings/get-elements-by-tag-name.html
+
+        Reviewed by Antti Koivisto.
+
+        * dom/NodeRareData.h:
+        (WebCore::NodeListsNodeData::addCacheWithAtomicName):
+        (WebCore::NodeListsNodeData::addCacheWithName):
+        (WebCore::NodeListsNodeData::addCacheWithQualifiedName):
+        (WebCore::NodeListsNodeData::addCachedCollection):
+
 2014-04-21  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r167584.

Modified: trunk/Source/WebCore/dom/NodeRareData.h (167588 => 167589)


--- trunk/Source/WebCore/dom/NodeRareData.h	2014-04-21 07:25:05 UTC (rev 167588)
+++ trunk/Source/WebCore/dom/NodeRareData.h	2014-04-21 10:15:40 UTC (rev 167589)
@@ -120,7 +120,7 @@
     template<typename T, typename ContainerType>
     PassRef<T> addCacheWithAtomicName(ContainerType& container, const AtomicString& name)
     {
-        NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(namedNodeListKey<T>(name), nullptr);
+        NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.fastAdd(namedNodeListKey<T>(name), nullptr);
         if (!result.isNewEntry)
             return static_cast<T&>(*result.iterator->value);
 
@@ -132,7 +132,7 @@
     template<typename T>
     PassRef<T> addCacheWithName(ContainerNode& node, const String& name)
     {
-        NodeListNameCacheMap::AddResult result = m_nameCaches.add(namedNodeListKey<T>(name), nullptr);
+        NodeListNameCacheMap::AddResult result = m_nameCaches.fastAdd(namedNodeListKey<T>(name), nullptr);
         if (!result.isNewEntry)
             return static_cast<T&>(*result.iterator->value);
 
@@ -144,7 +144,7 @@
     PassRef<TagNodeList> addCacheWithQualifiedName(ContainerNode& node, const AtomicString& namespaceURI, const AtomicString& localName)
     {
         QualifiedName name(nullAtom, localName, namespaceURI);
-        TagNodeListCacheNS::AddResult result = m_tagNodeListCacheNS.add(name, nullptr);
+        TagNodeListCacheNS::AddResult result = m_tagNodeListCacheNS.fastAdd(name, nullptr);
         if (!result.isNewEntry)
             return *result.iterator->value;
 
@@ -156,7 +156,7 @@
     template<typename T, typename ContainerType>
     PassRef<T> addCachedCollection(ContainerType& container, CollectionType collectionType, const AtomicString& name)
     {
-        CollectionCacheMap::AddResult result = m_cachedCollections.add(namedCollectionKey(collectionType, name), nullptr);
+        CollectionCacheMap::AddResult result = m_cachedCollections.fastAdd(namedCollectionKey(collectionType, name), nullptr);
         if (!result.isNewEntry)
             return static_cast<T&>(*result.iterator->value);
 
@@ -168,7 +168,7 @@
     template<typename T, typename ContainerType>
     PassRef<T> addCachedCollection(ContainerType& container, CollectionType collectionType)
     {
-        CollectionCacheMap::AddResult result = m_cachedCollections.add(namedCollectionKey(collectionType, starAtom), nullptr);
+        CollectionCacheMap::AddResult result = m_cachedCollections.fastAdd(namedCollectionKey(collectionType, starAtom), nullptr);
         if (!result.isNewEntry)
             return static_cast<T&>(*result.iterator->value);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to