Title: [123944] trunk/Source/WebCore
- Revision
- 123944
- Author
- [email protected]
- Date
- 2012-07-27 18:21:15 -0700 (Fri, 27 Jul 2012)
Log Message
[V8] Optimize Element::getAttributeNS() by replacing String with AtomicString
https://bugs.webkit.org/show_bug.cgi?id=90276
Patch by Kentaro Hara <[email protected]> on 2012-07-27
Reviewed by Adam Barth.
In r121439, we changed the argument type of Element::getAttribute()
from String to AtomicString for optimization. This patch changes the
argument type of Element::getAttributeNS() from String to AtomicString.
Actually this change affects V8 performance only.
[JSC without the patch]
The binding code converts a given _javascript_ string to a String
-> the String is passed to getAttributeNS()
-> the String is converted to an AtomicString when it is passed to
QualifiedName() constructor.
[JSC with the patch]
The binding code converts a given _javascript_ string to a String
-> the String is converted to an AtomicString when it is passed to
getAttributeNS()
-> the AtomicString is passed to QualifiedName() constructor.
[V8 without the patch]
The binding code retrieves a cached external String for a given
_javascript_ string
-> the String is passed to getAttributeNS()
-> the String is converted to AtomicString when it is passed to
QualifiedName() constructor.
[V8 with the patch]
The binding code retrieves a cached external AtomicString for a given
_javascript_ string
-> the AtomicString is passed to getAttributeNS()
-> the AtomicString is passed to QualifiedName() constructor.
In this way, in JSC, the change affects where a String is converted to
an AtomicString. On the other hand, in V8, (since the AtomicString is already
cached,) we can skip the conversion step.
Performance test: https://bugs.webkit.org/attachment.cgi?id=150158
getAttributeNS (Chromium/Linux):
577.80ms => 454.60ms
* dom/Element.cpp:
(WebCore::Element::getAttributeNS):
* dom/Element.h:
(Element):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (123943 => 123944)
--- trunk/Source/WebCore/ChangeLog 2012-07-28 01:02:33 UTC (rev 123943)
+++ trunk/Source/WebCore/ChangeLog 2012-07-28 01:21:15 UTC (rev 123944)
@@ -1,3 +1,55 @@
+2012-07-27 Kentaro Hara <[email protected]>
+
+ [V8] Optimize Element::getAttributeNS() by replacing String with AtomicString
+ https://bugs.webkit.org/show_bug.cgi?id=90276
+
+ Reviewed by Adam Barth.
+
+ In r121439, we changed the argument type of Element::getAttribute()
+ from String to AtomicString for optimization. This patch changes the
+ argument type of Element::getAttributeNS() from String to AtomicString.
+
+ Actually this change affects V8 performance only.
+
+ [JSC without the patch]
+ The binding code converts a given _javascript_ string to a String
+ -> the String is passed to getAttributeNS()
+ -> the String is converted to an AtomicString when it is passed to
+ QualifiedName() constructor.
+
+ [JSC with the patch]
+ The binding code converts a given _javascript_ string to a String
+ -> the String is converted to an AtomicString when it is passed to
+ getAttributeNS()
+ -> the AtomicString is passed to QualifiedName() constructor.
+
+ [V8 without the patch]
+ The binding code retrieves a cached external String for a given
+ _javascript_ string
+ -> the String is passed to getAttributeNS()
+ -> the String is converted to AtomicString when it is passed to
+ QualifiedName() constructor.
+
+ [V8 with the patch]
+ The binding code retrieves a cached external AtomicString for a given
+ _javascript_ string
+ -> the AtomicString is passed to getAttributeNS()
+ -> the AtomicString is passed to QualifiedName() constructor.
+
+ In this way, in JSC, the change affects where a String is converted to
+ an AtomicString. On the other hand, in V8, (since the AtomicString is already
+ cached,) we can skip the conversion step.
+
+ Performance test: https://bugs.webkit.org/attachment.cgi?id=150158
+
+ getAttributeNS (Chromium/Linux):
+ 577.80ms => 454.60ms
+
+ * dom/Element.cpp:
+ (WebCore::Element::getAttributeNS):
+ * dom/Element.h:
+ (Element):
+
2012-07-27 Sheriff Bot <[email protected]>
Unreviewed, rolling out r123679.
Modified: trunk/Source/WebCore/dom/Element.cpp (123943 => 123944)
--- trunk/Source/WebCore/dom/Element.cpp 2012-07-28 01:02:33 UTC (rev 123943)
+++ trunk/Source/WebCore/dom/Element.cpp 2012-07-28 01:21:15 UTC (rev 123944)
@@ -640,7 +640,7 @@
return nullAtom;
}
-const AtomicString& Element::getAttributeNS(const String& namespaceURI, const String& localName) const
+const AtomicString& Element::getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const
{
return getAttribute(QualifiedName(nullAtom, localName, namespaceURI));
}
Modified: trunk/Source/WebCore/dom/Element.h (123943 => 123944)
--- trunk/Source/WebCore/dom/Element.h 2012-07-28 01:02:33 UTC (rev 123943)
+++ trunk/Source/WebCore/dom/Element.h 2012-07-28 01:21:15 UTC (rev 123944)
@@ -143,7 +143,7 @@
bool hasAttributeNS(const String& namespaceURI, const String& localName) const;
const AtomicString& getAttribute(const AtomicString& name) const;
- const AtomicString& getAttributeNS(const String& namespaceURI, const String& localName) const;
+ const AtomicString& getAttributeNS(const AtomicString& namespaceURI, const AtomicString& localName) const;
void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);
static bool parseAttributeName(QualifiedName&, const AtomicString& namespaceURI, const AtomicString& qualifiedName, ExceptionCode&);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes