Changeset 36117 in webkit for trunk/JavaScriptCore/ChangeLog


Ignore:
Timestamp:
Sep 5, 2008, 2:51:22 PM (17 years ago)
Author:
Darin Adler
Message:

2008-09-05 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

1.011x as fast on SunSpider overall
1.028x as fast on SunSpider string tests

For small strings, use a loop rather than calling memcpy. The loop can
be faster because there's no function call overhead, and because it can
assume the pointers are aligned instead of checking that. Currently the
threshold is set at 20 characters, based on some testing on one particular
computer. Later we can tune this for various platforms by setting
USTRING_COPY_CHARS_INLINE_CUTOFF appropriately, but it does no great harm
if not perfectly tuned.

  • kjs/ustring.cpp: (KJS::overflowIndicator): Removed bogus const. (KJS::maxUChars): Ditto. (KJS::copyChars): Added. (KJS::UString::Rep::createCopying): Call copyChars instead of memcpy. Also eliminated need for const_cast. (KJS::UString::expandPreCapacity): Ditto. (KJS::concatenate): Ditto. (KJS::UString::spliceSubstringsWithSeparators): Ditto. (KJS::UString::append): Ditto.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36114 r36117  
     12008-09-05  Darin Adler  <[email protected]>
     2
     3        Reviewed by Sam Weinig.
     4
     5        - fix https://bugs.webkit.org/show_bug.cgi?id=20671
     6          JavaScriptCore string manipulation spends too much time in memcpy
     7
     8        1.011x as fast on SunSpider overall
     9        1.028x as fast on SunSpider string tests
     10
     11        For small strings, use a loop rather than calling memcpy. The loop can
     12        be faster because there's no function call overhead, and because it can
     13        assume the pointers are aligned instead of checking that. Currently the
     14        threshold is set at 20 characters, based on some testing on one particular
     15        computer. Later we can tune this for various platforms by setting
     16        USTRING_COPY_CHARS_INLINE_CUTOFF appropriately, but it does no great harm
     17        if not perfectly tuned.
     18
     19        * kjs/ustring.cpp:
     20        (KJS::overflowIndicator): Removed bogus const.
     21        (KJS::maxUChars): Ditto.
     22        (KJS::copyChars): Added.
     23        (KJS::UString::Rep::createCopying): Call copyChars instead of memcpy.
     24        Also eliminated need for const_cast.
     25        (KJS::UString::expandPreCapacity): Ditto.
     26        (KJS::concatenate): Ditto.
     27        (KJS::UString::spliceSubstringsWithSeparators): Ditto.
     28        (KJS::UString::append): Ditto.
     29
    1302008-09-05  Kevin McCullough  <[email protected]>
    231
Note: See TracChangeset for help on using the changeset viewer.