Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e306975420c1dec6a70ecb04992d4278379762fb
https://github.com/WebKit/WebKit/commit/e306975420c1dec6a70ecb04992d4278379762fb
Author: Yusuke Suzuki <[email protected]>
Date: 2025-10-22 (Wed, 22 Oct 2025)
Changed paths:
M Source/WTF/wtf/text/StringImpl.cpp
M Source/WTF/wtf/text/StringImpl.h
M Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp
Log Message:
-----------
Avoid creating 16-bit substring if string is enough small
https://bugs.webkit.org/show_bug.cgi?id=301320
rdar://163237518
Reviewed by Mark Lam.
This patch adds an optimization we generate non substring 8bit string
when 16bit string is enough small and they are latin-1 characters.
substring v.s. normal string has a tradeoff between allocation cost and
complicated retaining cost, and if allocation is not so costly, we
should just use non substring.
* Source/WTF/wtf/text/StringImpl.cpp:
(WTF::StringImpl::create8BitUnconditionally):
* Source/WTF/wtf/text/StringImpl.h:
(WTF::StringImpl::createSubstringSharingImpl):
* Tools/TestWebKitAPI/Tests/WTF/StringImpl.cpp:
(TestWebKitAPI::TEST(WTF, CreateSubstringSharingImpl)):
Canonical link: https://commits.webkit.org/302005@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications