Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4d2212f4f8ca37f93afa738fe4c52e2765a444b9
      
https://github.com/WebKit/WebKit/commit/4d2212f4f8ca37f93afa738fe4c52e2765a444b9
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-26 (Wed, 26 Aug 2026)

  Changed paths:
    M Source/WebCore/Modules/highlight/HighlightRegistry.cpp

  Log Message:
  -----------
  HighlightRegistry::addAnnotationHighlightWithRange() does redundant atom 
table and hash lookups
https://bugs.webkit.org/show_bug.cgi?id=322469
rdar://185755876

Reviewed by Chris Dumez.

annotationHighlightKey() returned an ASCIILiteral, so each use implicitly
constructed an AtomString, and AtomString(ASCIILiteral) calls
AtomStringImpl::add() under AtomStringTableLocker. Two of those ran on every
call: contains() then get() on the hit path, contains() then setFromMapLike() on
the miss path. Return a MainThreadNeverDestroyed<const AtomString> instead so 
the
atom is created once, and fold the contains()/get() pair into a single 
m_map.get()
so the key is hashed once rather than twice.

Using the RefPtr that get() already returns also drops a protect() call on the
raw map value.

No change in behavior.

* Source/WebCore/Modules/highlight/HighlightRegistry.cpp:
(WebCore::annotationHighlightKey):
(WebCore::HighlightRegistry::addAnnotationHighlightWithRange):

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



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

Reply via email to