Title: [103163] trunk/Source/WebCore
- Revision
- 103163
- Author
- [email protected]
- Date
- 2011-12-17 19:32:32 -0800 (Sat, 17 Dec 2011)
Log Message
TagNodeList: Optimize nodeMatches() for the common case.
<http://webkit.org/b/74796>
Reviewed by Antti Koivisto.
Reject based on tag name mismatch before comparing the namespaces,
as this case is vastly more common.
nodeMatches() is very hot on the DOM Query (Dojo) test on Dromaeo.
This change takes it from 8.3% to 7.7% on my MBP.
* dom/TagNodeList.cpp:
(WebCore::TagNodeList::nodeMatches):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (103162 => 103163)
--- trunk/Source/WebCore/ChangeLog 2011-12-18 03:28:35 UTC (rev 103162)
+++ trunk/Source/WebCore/ChangeLog 2011-12-18 03:32:32 UTC (rev 103163)
@@ -1,5 +1,21 @@
2011-12-17 Andreas Kling <[email protected]>
+ TagNodeList: Optimize nodeMatches() for the common case.
+ <http://webkit.org/b/74796>
+
+ Reviewed by Antti Koivisto.
+
+ Reject based on tag name mismatch before comparing the namespaces,
+ as this case is vastly more common.
+
+ nodeMatches() is very hot on the DOM Query (Dojo) test on Dromaeo.
+ This change takes it from 8.3% to 7.7% on my MBP.
+
+ * dom/TagNodeList.cpp:
+ (WebCore::TagNodeList::nodeMatches):
+
+2011-12-17 Andreas Kling <[email protected]>
+
NameNodeList: Use fastGetAttribute() in nodeMatches().
<http://webkit.org/b/74797>
Modified: trunk/Source/WebCore/dom/TagNodeList.cpp (103162 => 103163)
--- trunk/Source/WebCore/dom/TagNodeList.cpp 2011-12-18 03:28:35 UTC (rev 103162)
+++ trunk/Source/WebCore/dom/TagNodeList.cpp 2011-12-18 03:32:32 UTC (rev 103163)
@@ -47,10 +47,10 @@
bool TagNodeList::nodeMatches(Element* testNode) const
{
- if (m_namespaceURI != starAtom && m_namespaceURI != testNode->namespaceURI())
+ if (m_localName != starAtom && m_localName != testNode->localName())
return false;
- return m_localName == starAtom || m_localName == testNode->localName();
+ return m_namespaceURI == starAtom || m_namespaceURI == testNode->namespaceURI();
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes