Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 50f118c27cfa82d3409c1ea3addf2aa07d2904d7
      
https://github.com/WebKit/WebKit/commit/50f118c27cfa82d3409c1ea3addf2aa07d2904d7
  Author: Yusuke Suzuki <ysuz...@apple.com>
  Date:   2024-03-13 (Wed, 13 Mar 2024)

  Changed paths:
    M Source/WTF/wtf/HashTraits.h
    M Source/WebCore/platform/graphics/WidthCache.h

  Log Message:
  -----------
  [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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to