[webkit-changes] [WebKit/WebKit] 2984e2: Add String / StringView find() overloads that take...

Chris Dumez noreply at github.com
Thu Feb 16 19:02:10 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 2984e2efc933c81870c13ba5fa865ad01cbb60b1
      https://github.com/WebKit/WebKit/commit/2984e2efc933c81870c13ba5fa865ad01cbb60b1
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-02-16 (Thu, 16 Feb 2023)

  Changed paths:
    M Source/WTF/wtf/text/StringView.h
    M Source/WTF/wtf/text/WTFString.h

  Log Message:
  -----------
  Add String / StringView find() overloads that take in a LChar / char instead of a UChar
https://bugs.webkit.org/show_bug.cgi?id=252442

Reviewed by Yusuke Suzuki.

Add String / StringView find() overloads that take in a LChar / char instead of
a UChar. It is pretty common to see code in WebKit doing `string.find(':')`.
When the input string is 8-bit, converting ':' to a UChar can be inefficient as
we have optimized versions of StringImpl::find() / WTF::find() that take in a
LChar/char.

Got the idea from:
https://chromium.googlesource.com/chromium/blink/+/c70fbd89e637c6fbd7bfeb17e6f5b2ff2dae6f16

* Source/WTF/wtf/text/StringView.h:
(WTF::StringView::find const):
* Source/WTF/wtf/text/WTFString.h:

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




More information about the webkit-changes mailing list