Changeset 149013 in webkit


Ignore:
Timestamp:
Apr 23, 2013 6:10:51 PM (11 years ago)
Author:
akling@apple.com
Message:

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

From Blink r148621 by <timloh@chromium.org>:

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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r149012 r149013  
     12013-04-23  Andreas Kling  <akling@apple.com>
     2
     3        Micro-optimize Length::initFromLength().
     4        <http://webkit.org/b/115073>
     5
     6        From Blink r148621 by <timloh@chromium.org>:
     7
     8        This appears to improve html5-full-render by 1-2% on my system (gcc 4.6.3) by using memcpy
     9        instead of copying members (and branching to copy the union).
     10
     11        * platform/Length.h:
     12        (WebCore::Length::initFromLength):
     13
    1142013-04-23  Kent Tamura  <tkent@chromium.org>
    215
  • trunk/Source/WebCore/platform/Length.h

    r146272 r149013  
    2525
    2626#include "AnimationUtilities.h"
     27#include <string.h>
    2728#include <wtf/Assertions.h>
    2829#include <wtf/FastAllocBase.h>
     
    280281        return m_isFloat ? static_cast<int>(m_floatValue) : m_intValue;
    281282    }
    282     void initFromLength(const Length &length)
    283     {
    284         m_quirk = length.m_quirk;
    285         m_type = length.m_type;
    286         m_isFloat = length.m_isFloat;
    287        
    288         if (m_isFloat)
    289             m_floatValue = length.m_floatValue;
    290         else
    291             m_intValue = length.m_intValue;
    292        
     283    void initFromLength(const Length& length)
     284    {
     285        memcpy(this, &length, sizeof(Length));
    293286        if (isCalculated())
    294287            incrementCalculatedRef();
Note: See TracChangeset for help on using the changeset viewer.