Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9aa3d110dc34bbb756d78c82b05e2cbe1de4c12b
      
https://github.com/WebKit/WebKit/commit/9aa3d110dc34bbb756d78c82b05e2cbe1de4c12b
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-07-01 (Wed, 01 Jul 2026)

  Changed paths:
    M Source/WebCore/editing/ios/DictationCommandIOS.cpp
    M Source/WebCore/editing/ios/EditorIOS.mm

  Log Message:
  -----------
  Avoid O(n) front-shift when building dictation alternatives Vector
https://bugs.webkit.org/show_bug.cgi?id=318196
rdar://181001492

Reviewed by Chris Dumez.

DictationCommandIOS::doApply() and Editor::setDictationPhrasesAsChildOfElement()
both built the "alternatives" Vector by copying the entire interpretations
Vector and then calling removeAt(0). removeAt(0) shifts every remaining element
down by one, so this was an O(n) copy followed by a second O(n) front-shift.

Use subvector(1) directly instead, which copies the tail directly in a single
pass and drops the first interpretation without any shifting.

No change in behavior, so no new tests.

* Source/WebCore/editing/ios/DictationCommandIOS.cpp:
(WebCore::DictationCommandIOS::doApply):
* Source/WebCore/editing/ios/EditorIOS.mm:
(WebCore::Editor::setDictationPhrasesAsChildOfElement):

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



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

Reply via email to