Title: [131678] trunk/Source/WebCore
Revision
131678
Author
[email protected]
Date
2012-10-17 17:24:03 -0700 (Wed, 17 Oct 2012)

Log Message

Make dom-query.html slightly faster by removing unnecessary ref-churn in StringTraits
https://bugs.webkit.org/show_bug.cgi?id=99652

Reviewed by Adam Barth.

My testing showed this moved dom-query.html from  465560 runs/s to 479019
which is about 2% if I'm doing my math correctly.

I suspect that's due to avoiding the ref-churn we were incurring by using
return-by-value symantics here.

This is just the tip of the iceburg. :)

* bindings/v8/V8StringResource.cpp:
(StringTraits):
* bindings/v8/V8ValueCache.h:
(WebCore::WebCoreStringResource::webcoreString):
(WebCore::WebCoreStringResource::atomicString):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131677 => 131678)


--- trunk/Source/WebCore/ChangeLog	2012-10-18 00:18:16 UTC (rev 131677)
+++ trunk/Source/WebCore/ChangeLog	2012-10-18 00:24:03 UTC (rev 131678)
@@ -1,3 +1,24 @@
+2012-10-17  Eric Seidel  <[email protected]>
+
+        Make dom-query.html slightly faster by removing unnecessary ref-churn in StringTraits
+        https://bugs.webkit.org/show_bug.cgi?id=99652
+
+        Reviewed by Adam Barth.
+
+        My testing showed this moved dom-query.html from  465560 runs/s to 479019
+        which is about 2% if I'm doing my math correctly.
+
+        I suspect that's due to avoiding the ref-churn we were incurring by using
+        return-by-value symantics here.
+
+        This is just the tip of the iceburg. :)
+
+        * bindings/v8/V8StringResource.cpp:
+        (StringTraits):
+        * bindings/v8/V8ValueCache.h:
+        (WebCore::WebCoreStringResource::webcoreString):
+        (WebCore::WebCoreStringResource::atomicString):
+
 2012-10-17  Luke Macpherson   <[email protected]>
 
         Move handling of CSSPropertyWebkitLineClamp from StyleResolver into StyleBuilder.

Modified: trunk/Source/WebCore/bindings/v8/V8StringResource.cpp (131677 => 131678)


--- trunk/Source/WebCore/bindings/v8/V8StringResource.cpp	2012-10-18 00:18:16 UTC (rev 131677)
+++ trunk/Source/WebCore/bindings/v8/V8StringResource.cpp	2012-10-18 00:24:03 UTC (rev 131678)
@@ -30,14 +30,14 @@
 
 namespace WebCore {
 
-template <class S> struct StringTraits {
-    static S fromStringResource(WebCoreStringResource*);
-    static S fromV8String(v8::Handle<v8::String>, int);
+template <class StringClass> struct StringTraits {
+    static const StringClass& fromStringResource(WebCoreStringResource*);
+    static StringClass fromV8String(v8::Handle<v8::String>, int);
 };
 
 template<>
 struct StringTraits<String> {
-    static String fromStringResource(WebCoreStringResource* resource)
+    static const String& fromStringResource(WebCoreStringResource* resource)
     {
         return resource->webcoreString();
     }
@@ -56,7 +56,7 @@
 
 template<>
 struct StringTraits<AtomicString> {
-    static AtomicString fromStringResource(WebCoreStringResource* resource)
+    static const AtomicString& fromStringResource(WebCoreStringResource* resource)
     {
         return resource->atomicString();
     }

Modified: trunk/Source/WebCore/bindings/v8/V8ValueCache.h (131677 => 131678)


--- trunk/Source/WebCore/bindings/v8/V8ValueCache.h	2012-10-18 00:18:16 UTC (rev 131677)
+++ trunk/Source/WebCore/bindings/v8/V8ValueCache.h	2012-10-18 00:24:03 UTC (rev 131678)
@@ -113,9 +113,9 @@
 
     virtual size_t length() const { return m_plainString.impl()->length(); }
 
-    String webcoreString() { return m_plainString; }
+    const String& webcoreString() { return m_plainString; }
 
-    AtomicString atomicString()
+    const AtomicString& atomicString()
     {
 #ifndef NDEBUG
         ASSERT(m_threadId == WTF::currentThread());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to