Changeset 167589 in webkit


Ignore:
Timestamp:
Apr 21, 2014 3:15:40 AM (10 years ago)
Author:
akling@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167588 r167589  
     12014-04-21  Andreas Kling  <akling@apple.com>
     2
     3        Micro-optimize the way we hand NodeLists to JSC.
     4        <https://webkit.org/b/131932>
     5
     6        Use HashMap::fastAdd() when returning cached node lists and collections.
     7        10.9% progression on Bindings/get-elements-by-tag-name.html
     8
     9        Reviewed by Antti Koivisto.
     10
     11        * dom/NodeRareData.h:
     12        (WebCore::NodeListsNodeData::addCacheWithAtomicName):
     13        (WebCore::NodeListsNodeData::addCacheWithName):
     14        (WebCore::NodeListsNodeData::addCacheWithQualifiedName):
     15        (WebCore::NodeListsNodeData::addCachedCollection):
     16
    1172014-04-21  Commit Queue  <commit-queue@webkit.org>
    218
  • trunk/Source/WebCore/dom/NodeRareData.h

    r167220 r167589  
    121121    PassRef<T> addCacheWithAtomicName(ContainerType& container, const AtomicString& name)
    122122    {
    123         NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.add(namedNodeListKey<T>(name), nullptr);
     123        NodeListAtomicNameCacheMap::AddResult result = m_atomicNameCaches.fastAdd(namedNodeListKey<T>(name), nullptr);
    124124        if (!result.isNewEntry)
    125125            return static_cast<T&>(*result.iterator->value);
     
    133133    PassRef<T> addCacheWithName(ContainerNode& node, const String& name)
    134134    {
    135         NodeListNameCacheMap::AddResult result = m_nameCaches.add(namedNodeListKey<T>(name), nullptr);
     135        NodeListNameCacheMap::AddResult result = m_nameCaches.fastAdd(namedNodeListKey<T>(name), nullptr);
    136136        if (!result.isNewEntry)
    137137            return static_cast<T&>(*result.iterator->value);
     
    145145    {
    146146        QualifiedName name(nullAtom, localName, namespaceURI);
    147         TagNodeListCacheNS::AddResult result = m_tagNodeListCacheNS.add(name, nullptr);
     147        TagNodeListCacheNS::AddResult result = m_tagNodeListCacheNS.fastAdd(name, nullptr);
    148148        if (!result.isNewEntry)
    149149            return *result.iterator->value;
     
    157157    PassRef<T> addCachedCollection(ContainerType& container, CollectionType collectionType, const AtomicString& name)
    158158    {
    159         CollectionCacheMap::AddResult result = m_cachedCollections.add(namedCollectionKey(collectionType, name), nullptr);
     159        CollectionCacheMap::AddResult result = m_cachedCollections.fastAdd(namedCollectionKey(collectionType, name), nullptr);
    160160        if (!result.isNewEntry)
    161161            return static_cast<T&>(*result.iterator->value);
     
    169169    PassRef<T> addCachedCollection(ContainerType& container, CollectionType collectionType)
    170170    {
    171         CollectionCacheMap::AddResult result = m_cachedCollections.add(namedCollectionKey(collectionType, starAtom), nullptr);
     171        CollectionCacheMap::AddResult result = m_cachedCollections.fastAdd(namedCollectionKey(collectionType, starAtom), nullptr);
    172172        if (!result.isNewEntry)
    173173            return static_cast<T&>(*result.iterator->value);
Note: See TracChangeset for help on using the changeset viewer.