Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1969cf2d9ec209dbb6724b43c5e618cac5a4fae6
      
https://github.com/WebKit/WebKit/commit/1969cf2d9ec209dbb6724b43c5e618cac5a4fae6
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-08-17 (Mon, 17 Aug 2026)

  Changed paths:
    M Source/WTF/wtf/text/StringImpl.cpp

  Log Message:
  -----------
  [WTF] StringImpl::replace(char16_t, char16_t) scans for the target with a 
scalar loop instead of SIMD find()
https://bugs.webkit.org/show_bug.cgi?id=321836
rdar://184981918

Reviewed by Yusuke Suzuki.

Both the 8-bit and 16-bit paths of StringImpl::replace(char16_t, char16_t)
hand-rolled a byte-at-a-time loop to locate the first occurrence of the
target before handing off to createByReplacingInCharacters(). This is the
same defect fixed for makeStringByReplacingAll() in bug 321055
(6cb1077d85c8), which was applied to StringView.cpp but missed this
sibling in StringImpl.cpp.

Replace both loops with WTF::find(), which is SIMD-accelerated. Collapsing
the two paths into a generic lambda also lets the isLatin1(target)
early-out go: find(std::span<const Latin1Character>, char16_t) already
returns notFound for a non-Latin1 target, so an 8-bit string searched for
a 16-bit character still bails out without touching the characters. No
behavior change.

* Source/WTF/wtf/text/StringImpl.cpp:
(WTF::StringImpl::replace):

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



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

Reply via email to