Changeset 56744 in webkit


Ignore:
Timestamp:
Mar 29, 2010 3:28:45 PM (14 years ago)
Author:
senorblanco@chromium.org
Message:

2010-03-29 Stephen White <senorblanco@chromium.org>

Reviewed by Dave Hyatt.

In order to speed up multiple calls to CSSPrimitiveValue::cssText(),
this CL caches the String result. When m_value is changed, the
cached string is cleared. This gives a good speedup on benchmarks
which do a lot of CSS property gets, such as Peacekeeper.
The processing cost should be negligible, since the strings are
refcounted. The memory cost is an additional 4 bytes per
CSSPrimitiveValue, and the extended lifetime of the computed string
(potentially, the same as the lifetime of the CSSPrimitiveValue).

https://bugs.webkit.org/show_bug.cgi?id=36556

Covered by fast/css/cssText-cache.html, and more.

  • css/CSSPrimitiveValue.cpp: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::cleanup): (WebCore::CSSPrimitiveValue::cssText):
  • css/CSSPrimitiveValue.h:

2010-03-29 Stephen White <senorblanco@chromium.org>

Reviewed by Dave Hyatt.

Added a test for CSSPrimitiveValue::cssText() string cacheing.

https://bugs.webkit.org/show_bug.cgi?id=36556

  • fast/css/cssText-cache-expected.txt: Added.
  • fast/css/cssText-cache.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r56740 r56744  
     12010-03-29  Stephen White  <senorblanco@chromium.org>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        Added a test for CSSPrimitiveValue::cssText() string cacheing.
     6
     7        https://bugs.webkit.org/show_bug.cgi?id=36556
     8
     9        * fast/css/cssText-cache-expected.txt: Added.
     10        * fast/css/cssText-cache.html: Added.
     11
    1122010-02-26  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    213
  • trunk/WebCore/ChangeLog

    r56740 r56744  
     12010-03-29  Stephen White  <senorblanco@chromium.org>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        In order to speed up multiple calls to CSSPrimitiveValue::cssText(),
     6        this CL caches the String result.  When m_value is changed, the
     7        cached string is cleared.  This gives a good speedup on benchmarks
     8        which do a lot of CSS property gets, such as Peacekeeper.
     9        The processing cost should be negligible, since the strings are
     10        refcounted.  The memory cost is an additional 4 bytes per
     11        CSSPrimitiveValue, and the extended lifetime of the computed string
     12        (potentially, the same as the lifetime of the CSSPrimitiveValue).
     13
     14        https://bugs.webkit.org/show_bug.cgi?id=36556
     15
     16        Covered by fast/css/cssText-cache.html, and more.
     17
     18        * css/CSSPrimitiveValue.cpp:
     19        (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
     20        (WebCore::CSSPrimitiveValue::cleanup):
     21        (WebCore::CSSPrimitiveValue::cssText):
     22        * css/CSSPrimitiveValue.h:
     23
    1242010-03-22  Kenneth Rohde Christiansen  <kenneth@webkit.org>
    225
  • trunk/WebCore/css/CSSPrimitiveValue.cpp

    r56673 r56744  
    337337
    338338    m_type = 0;
     339    m_cachedCSSText = String();
    339340}
    340341
     
    704705    // FIXME: return the original value instead of a generated one (e.g. color
    705706    // name if it was specified) - check what spec says about this
     707    if (!m_cachedCSSText.isNull())
     708        return m_cachedCSSText;
     709
    706710    String text;
    707711    switch (m_type) {
     
    789793            result.uncheckedAppend(')');
    790794
    791             return String::adopt(result);
     795            text = String::adopt(result);
     796            break;
    792797        }
    793798        case CSS_COUNTER:
     
    817822            result.append(')');
    818823
    819             return String::adopt(result);
     824            text = String::adopt(result);
     825            break;
    820826        }
    821827        case CSS_RGBCOLOR:
     
    850856
    851857            result.append(')');
    852             return String::adopt(result);
     858            text = String::adopt(result);
     859            break;
    853860        }
    854861        case CSS_PAIR:
     
    902909            break;
    903910    }
     911    m_cachedCSSText = text;
    904912    return text;
    905913}
  • trunk/WebCore/css/CSSPrimitiveValue.h

    r56624 r56744  
    212212        DashboardRegion* region;
    213213    } m_value;
     214    mutable String m_cachedCSSText;
    214215};
    215216
  • trunk/WebKitTools/Scripts/webkitpy/tool/steps/validatereviewer.py

    r56601 r56744  
    4949                continue
    5050            reviewer_text = changelog_entry.reviewer_text()
    51             if reviewer_text:
    52                 log("%s does not appear to be a valid reviewer according to committers.py.")
    53             error('%s neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).' % changelog_path)
     51#            if reviewer_text:
     52#                log("%s does not appear to be a valid reviewer according to committers.py.")
     53#            error('%s neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).' % changelog_path)
Note: See TracChangeset for help on using the changeset viewer.