Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 50f118c. rdar://125141520
[WebCore] Optimize WidthCache further https://bugs.webkit.org/show_bug.cgi?id=270901 rdar://124512596 Reviewed by Ryosuke Niwa. This patch further optimizes WidthCache. 1. Ensure that SmallStringKey constructor is always inlined. 2. Add copySmallCharacters. We know that this string is <= 16, very small. Just doing for-loop is faster for this level of size. 3. Add FloatWithZeroEmptyKeyHashTraits. float / double uses infinity for empty value. But this means that we cannot use zeroed empty value for HashMap<T, float> even though T's empty value is zero. We add FloatWithZeroEmptyKeyHashTraits which uses 0 for empty value, so that we can ensure that KeyValuePair<T, float>'s empty value is zero. Also, using character + 1 for key in SingleCharMap so that it can make empty value zero too. * Source/WTF/wtf/HashTraits.h: (WTF::FloatWithZeroEmptyKeyHashTraits::emptyValue): (WTF::FloatWithZeroEmptyKeyHashTraits::constructDeletedValue): (WTF::FloatWithZeroEmptyKeyHashTraits::isDeletedValue): * Source/WebCore/platform/graphics/WidthCache.h: (WebCore::WidthCache::SmallStringKey::SmallStringKey): (WebCore::WidthCache::SmallStringKey::copySmallCharacters): (WebCore::WidthCache::addSlowCase): Canonical link: https://commits.webkit.org/276034@main Identifier: 272448.829@safari-7618-branch
- Loading branch information