Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 97b25967e86e2cdf28b0f1dea134d78659881e86
      
https://github.com/WebKit/WebKit/commit/97b25967e86e2cdf28b0f1dea134d78659881e86
  Author: Cole Carley <[email protected]>
  Date:   2026-07-24 (Fri, 24 Jul 2026)

  Changed paths:
    M Source/WebCore/editing/ICUSearcher.cpp

  Log Message:
  -----------
  Find in Page "Begins with" option takes too long
https://bugs.webkit.org/show_bug.cgi?id=320120
rdar://183061866

Reviewed by Sammy Gill.

Searching for a string on a large page with the "Beings with" Find in
Page option takes significantly longer than searching with the "contains"
option.

The slowdown is caused by passing the entire buffer to findNextWordFromIndex
from TextBoundaries.h on every match. Note that this only happens when the
match does not require context for word boundaries. On mac,
findNextWordFromIndex copies the buffer to a new string.

To speed this up, we limit the size of the buffer passed to 
findNextWordFromIndex.
Instead of the whole buffer, we send a window that includes the match. This way,
the copy can be much faster.

* Source/WebCore/editing/ICUSearcher.cpp:
(WebCore::boundedWordContextForNonComplexText):
(WebCore::wordBreakContext):
(WebCore::isWordStartMatch):
(WebCore::isWordEndMatch):

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



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

Reply via email to