Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8854738a99112e8e38814bce4f6726b24928e0fe
      
https://github.com/WebKit/WebKit/commit/8854738a99112e8e38814bce4f6726b24928e0fe
  Author: Charlie Wolfe <[email protected]>
  Date:   2026-09-08 (Tue, 08 Sep 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/TextMeasurementCache.h

  Log Message:
  -----------
  Hash and compare only the used characters of a TextMeasurementCache 
SmallStringKey
https://bugs.webkit.org/show_bug.cgi?id=323724
rdar://186973909

Reviewed by Gerald Squelart.

SmallStringKey stores text inline in a zero-filled 64-entry char16_t array, and 
hashed all 128 bytes
of it no matter how short the string was. The defaulted operator== also 
compared the whole array on
every probe. Hash only the first length code units, and compare m_hashAndLength 
first. It packs both
the hash and the length, so a mismatched bucket costs one word compare and only 
a match compares
characters. The trailing bytes were always zero, so the same strings hash and 
compare equal as
before.

* Source/WebCore/platform/graphics/TextMeasurementCache.h:
(WebCore::TextMeasurementCache::SmallStringKey::SmallStringKey):
(WebCore::TextMeasurementCache::SmallStringKey::operator==):

Canonical link: https://commits.webkit.org/320710@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to