Title: [124972] trunk/Source/WebCore
Revision
124972
Author
hara...@chromium.org
Date
2012-08-07 19:41:20 -0700 (Tue, 07 Aug 2012)

Log Message

Optimize Element::getAttributeNode() by replacing String with AtomicString
https://bugs.webkit.org/show_bug.cgi?id=90274

Reviewed by Adam Barth.

Based on the observation described in this ChangeLog
(http://trac.webkit.org/changeset/121439), this patch optimizes
the performance of Element::getAttributeNode() by replacing String
with AtomicString.

Performance test: https://bugs.webkit.org/attachment.cgi?id=150147

getAttributeNode (Chromium/Linux):
375.20ms => 310.80ms

getAttributeNodeNS (Chromium/Linux):
684.40ms => 539.00ms

* dom/Element.cpp:
(WebCore::Element::getAttributeNode):
(WebCore::Element::getAttributeNodeNS):
* dom/Element.h:
(Element):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124971 => 124972)


--- trunk/Source/WebCore/ChangeLog	2012-08-08 02:27:58 UTC (rev 124971)
+++ trunk/Source/WebCore/ChangeLog	2012-08-08 02:41:20 UTC (rev 124972)
@@ -1,3 +1,29 @@
+2012-08-07  Kentaro Hara  <hara...@chromium.org>
+
+        Optimize Element::getAttributeNode() by replacing String with AtomicString
+        https://bugs.webkit.org/show_bug.cgi?id=90274
+
+        Reviewed by Adam Barth.
+
+        Based on the observation described in this ChangeLog
+        (http://trac.webkit.org/changeset/121439), this patch optimizes
+        the performance of Element::getAttributeNode() by replacing String
+        with AtomicString.
+
+        Performance test: https://bugs.webkit.org/attachment.cgi?id=150147
+
+        getAttributeNode (Chromium/Linux):
+        375.20ms => 310.80ms
+
+        getAttributeNodeNS (Chromium/Linux):
+        684.40ms => 539.00ms
+
+        * dom/Element.cpp:
+        (WebCore::Element::getAttributeNode):
+        (WebCore::Element::getAttributeNodeNS):
+        * dom/Element.h:
+        (Element):
+
 2012-08-07  Michelangelo De Simone  <michelang...@webkit.org>
 
         CSSParser::parseTransform() refactor to accept valueList as argument

Modified: trunk/Source/WebCore/dom/Element.cpp (124971 => 124972)


--- trunk/Source/WebCore/dom/Element.cpp	2012-08-08 02:27:58 UTC (rev 124971)
+++ trunk/Source/WebCore/dom/Element.cpp	2012-08-08 02:41:20 UTC (rev 124972)
@@ -1516,7 +1516,7 @@
     removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
 }
 
-PassRefPtr<Attr> Element::getAttributeNode(const String& name)
+PassRefPtr<Attr> Element::getAttributeNode(const AtomicString& name)
 {
     const ElementAttributeData* attributeData = updatedAttributeData();
     if (!attributeData)
@@ -1524,7 +1524,7 @@
     return attributeData->getAttributeNode(name, shouldIgnoreAttributeCase(this), this);
 }
 
-PassRefPtr<Attr> Element::getAttributeNodeNS(const String& namespaceURI, const String& localName)
+PassRefPtr<Attr> Element::getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName)
 {
     const ElementAttributeData* attributeData = updatedAttributeData();
     if (!attributeData)

Modified: trunk/Source/WebCore/dom/Element.h (124971 => 124972)


--- trunk/Source/WebCore/dom/Element.h	2012-08-08 02:27:58 UTC (rev 124971)
+++ trunk/Source/WebCore/dom/Element.h	2012-08-08 02:41:20 UTC (rev 124972)
@@ -206,8 +206,8 @@
 
     PassRefPtr<Attr> detachAttribute(size_t index);
 
-    PassRefPtr<Attr> getAttributeNode(const String& name);
-    PassRefPtr<Attr> getAttributeNodeNS(const String& namespaceURI, const String& localName);
+    PassRefPtr<Attr> getAttributeNode(const AtomicString& name);
+    PassRefPtr<Attr> getAttributeNodeNS(const AtomicString& namespaceURI, const AtomicString& localName);
     PassRefPtr<Attr> setAttributeNode(Attr*, ExceptionCode&);
     PassRefPtr<Attr> setAttributeNodeNS(Attr*, ExceptionCode&);
     PassRefPtr<Attr> removeAttributeNode(Attr*, ExceptionCode&);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to