Title: [149013] trunk/Source/WebCore
Revision
149013
Author
[email protected]
Date
2013-04-23 18:10:51 -0700 (Tue, 23 Apr 2013)

Log Message

Micro-optimize Length::initFromLength().
<http://webkit.org/b/115073>

>From Blink r148621 by <[email protected]>:

This appears to improve html5-full-render by 1-2% on my system (gcc 4.6.3) by using memcpy
instead of copying members (and branching to copy the union).

* platform/Length.h:
(WebCore::Length::initFromLength):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149012 => 149013)


--- trunk/Source/WebCore/ChangeLog	2013-04-24 01:06:01 UTC (rev 149012)
+++ trunk/Source/WebCore/ChangeLog	2013-04-24 01:10:51 UTC (rev 149013)
@@ -1,3 +1,16 @@
+2013-04-23  Andreas Kling  <[email protected]>
+
+        Micro-optimize Length::initFromLength().
+        <http://webkit.org/b/115073>
+
+        From Blink r148621 by <[email protected]>:
+
+        This appears to improve html5-full-render by 1-2% on my system (gcc 4.6.3) by using memcpy
+        instead of copying members (and branching to copy the union).
+
+        * platform/Length.h:
+        (WebCore::Length::initFromLength):
+
 2013-04-23  Kent Tamura  <[email protected]>
 
         Add missing copyright header to ColorChooserClient.h

Modified: trunk/Source/WebCore/platform/Length.h (149012 => 149013)


--- trunk/Source/WebCore/platform/Length.h	2013-04-24 01:06:01 UTC (rev 149012)
+++ trunk/Source/WebCore/platform/Length.h	2013-04-24 01:10:51 UTC (rev 149013)
@@ -24,6 +24,7 @@
 #define Length_h
 
 #include "AnimationUtilities.h"
+#include <string.h>
 #include <wtf/Assertions.h>
 #include <wtf/FastAllocBase.h>
 #include <wtf/Forward.h>
@@ -279,17 +280,9 @@
         ASSERT(!isUndefined());
         return m_isFloat ? static_cast<int>(m_floatValue) : m_intValue;
     }
-    void initFromLength(const Length &length) 
+    void initFromLength(const Length& length)
     {
-        m_quirk = length.m_quirk;
-        m_type = length.m_type;
-        m_isFloat = length.m_isFloat;
-        
-        if (m_isFloat)
-            m_floatValue = length.m_floatValue;
-        else
-            m_intValue = length.m_intValue;
-        
+        memcpy(this, &length, sizeof(Length));
         if (isCalculated())
             incrementCalculatedRef();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to