Title: [125008] trunk/Source/WebCore
Revision
125008
Author
hara...@chromium.org
Date
2012-08-08 01:24:44 -0700 (Wed, 08 Aug 2012)

Log Message

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

Reviewed by Adam Barth.

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

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

removeAttribute (Chromium/Linux):
334.20ms => 240.60ms

removeAttributeNS (Chromium/Linux):
552.80ms => 421.60ms

* dom/Element.cpp:
(WebCore::Element::removeAttribute):
(WebCore::Element::removeAttributeNS):
* dom/Element.h:
(Element):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125007 => 125008)


--- trunk/Source/WebCore/ChangeLog	2012-08-08 08:13:11 UTC (rev 125007)
+++ trunk/Source/WebCore/ChangeLog	2012-08-08 08:24:44 UTC (rev 125008)
@@ -1,3 +1,28 @@
+2012-08-08  Kentaro Hara  <hara...@chromium.org>
+
+        Optimize Element::removeAttribute() by replacing String with AtomicString
+        https://bugs.webkit.org/show_bug.cgi?id=90265
+
+        Reviewed by Adam Barth.
+
+        Based on the observation described in this ChangeLog
+        (http://trac.webkit.org/changeset/121439), this patch optimizes
+        Element::removeAttribute() by replacing String with AtomicString.
+
+        Performance test: https://bugs.webkit.org/attachment.cgi?id=150140
+
+        removeAttribute (Chromium/Linux):
+        334.20ms => 240.60ms
+
+        removeAttributeNS (Chromium/Linux):
+        552.80ms => 421.60ms
+
+        * dom/Element.cpp:
+        (WebCore::Element::removeAttribute):
+        (WebCore::Element::removeAttributeNS):
+        * dom/Element.h:
+        (Element):
+
 2012-08-08  Shinya Kawanaka  <shin...@chromium.org>
 
         Remove Element::ensureShadowRoot

Modified: trunk/Source/WebCore/dom/Element.cpp (125007 => 125008)


--- trunk/Source/WebCore/dom/Element.cpp	2012-08-08 08:13:11 UTC (rev 125007)
+++ trunk/Source/WebCore/dom/Element.cpp	2012-08-08 08:24:44 UTC (rev 125008)
@@ -1490,12 +1490,12 @@
     mutableAttributeData()->removeAttribute(index, this);
 }
 
-void Element::removeAttribute(const String& name)
+void Element::removeAttribute(const AtomicString& name)
 {
     if (!attributeData())
         return;
 
-    String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
+    AtomicString localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
     size_t index = attributeData()->getAttributeItemIndex(localName, false);
     if (index == notFound)
         return;
@@ -1503,7 +1503,7 @@
     mutableAttributeData()->removeAttribute(index, this);
 }
 
-void Element::removeAttributeNS(const String& namespaceURI, const String& localName)
+void Element::removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName)
 {
     removeAttribute(QualifiedName(nullAtom, localName, namespaceURI));
 }

Modified: trunk/Source/WebCore/dom/Element.h (125007 => 125008)


--- trunk/Source/WebCore/dom/Element.h	2012-08-08 08:13:11 UTC (rev 125007)
+++ trunk/Source/WebCore/dom/Element.h	2012-08-08 08:24:44 UTC (rev 125008)
@@ -201,8 +201,8 @@
     // Returns the absolute bounding box translated into screen coordinates:
     IntRect screenRect() const;
 
-    void removeAttribute(const String& name);
-    void removeAttributeNS(const String& namespaceURI, const String& localName);
+    void removeAttribute(const AtomicString& name);
+    void removeAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName);
 
     PassRefPtr<Attr> detachAttribute(size_t index);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to