Changeset 152438 in webkit


Ignore:
Timestamp:
Jul 6, 2013 11:46:39 PM (11 years ago)
Author:
benjamin@webkit.org
Message:

Fix the performance regressions introduced by r152418
https://bugs.webkit.org/show_bug.cgi?id=118438

Reviewed by Sam Weinig.

  • wtf/text/StringImpl.h:

(WTF::equal):
Looping between two arbitrary pointers prevents important loop
optimizations.

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r152429 r152438  
     12013-07-06  Benjamin Poulain  <benjamin@webkit.org>
     2
     3        Fix the performance regressions introduced by r152418
     4        https://bugs.webkit.org/show_bug.cgi?id=118438
     5
     6        Reviewed by Sam Weinig.
     7
     8        * wtf/text/StringImpl.h:
     9        (WTF::equal):
     10        Looping between two arbitrary pointers prevents important loop
     11        optimizations.
     12
    1132013-07-05  Brent Fulgham  <bfulgham@apple.com>
    214
  • trunk/Source/WTF/wtf/text/StringImpl.h

    r152418 r152438  
    10781078}
    10791079#else
    1080 ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length) { return std::equal(a, a + length, b); }
    1081 ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length) { return std::equal(a, a + length, b); }
    1082 #endif
    1083 
    1084 ALWAYS_INLINE bool equal(const LChar* a, const UChar* b, unsigned length) { return std::equal(a, a + length, b); }
    1085 ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length) { return std::equal(a, a + length, b); }
     1080ALWAYS_INLINE bool equal(const LChar* a, const LChar* b, unsigned length) { return !memcmp(a, b, length); }
     1081ALWAYS_INLINE bool equal(const UChar* a, const UChar* b, unsigned length) { return !memcmp(a, b, length * sizeof(UChar)); }
     1082#endif
     1083
     1084ALWAYS_INLINE bool equal(const LChar* a, const UChar* b, unsigned length)
     1085{
     1086    for (unsigned i = 0; i < length; ++i) {
     1087        if (a[i] != b[i])
     1088            return false;
     1089    }
     1090    return true;
     1091}
     1092
     1093ALWAYS_INLINE bool equal(const UChar* a, const LChar* b, unsigned length) { return equal(b, a, length); }
     1094
    10861095WTF_EXPORT_STRING_API bool equalIgnoringCase(const StringImpl*, const StringImpl*);
    10871096WTF_EXPORT_STRING_API bool equalIgnoringCase(const StringImpl*, const LChar*);
Note: See TracChangeset for help on using the changeset viewer.