Changeset 201738 in webkit
- Timestamp:
- Jun 6, 2016 8:24:54 PM (8 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r201684 r201738 1 2016-06-06 Saam Barati <sbarati@apple.com> 2 3 equal(StringView, StringView) for strings should have a fast path for pointer equality 4 https://bugs.webkit.org/show_bug.cgi?id=158452 5 6 Reviewed by Andreas Kling. 7 8 JSBench does a lot of StringView::operator== on StringViews that have 9 the same underlying characters pointer. This becomes hot inside JSBench 10 because JSBench heavily stresses JSC's UnlinkedCodeCache with a high 11 hit rate. This means that when we get a hit in the cache, we used to 12 do the long form of string compare. However, we were often comparing 13 two StringViews that had the same underlying buffer and length. 14 This patch speeds this case up to run in constant time instead of 15 linear time. 16 17 * wtf/text/StringCommon.h: 18 (WTF::equalCommon): 19 * wtf/text/StringImpl.h: 20 (WTF::StringImpl::StringImpl): 21 (WTF::StringImpl::data): 22 * wtf/text/StringView.h: 23 (WTF::StringView::data): 24 1 25 2016-06-04 Anders Carlsson <andersca@apple.com> 2 26 -
trunk/Source/WTF/wtf/text/StringView.h
r196080 r201738 136 136 137 137 private: 138 friend bool equal(StringView, StringView); 139 138 140 void initialize(const LChar*, unsigned length); 139 141 void initialize(const UChar*, unsigned length); … … 526 528 inline bool equal(StringView a, StringView b) 527 529 { 530 if (a.m_characters == b.m_characters) { 531 ASSERT(a.is8Bit() == b.is8Bit()); 532 return a.length() == b.length(); 533 } 534 528 535 return equalCommon(a, b); 529 536 }
Note: See TracChangeset
for help on using the changeset viewer.