Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2526a45e199d29c41a19e2726f7b1fe672197529
https://github.com/WebKit/WebKit/commit/2526a45e199d29c41a19e2726f7b1fe672197529
Author: Sosuke Suzuki <[email protected]>
Date: 2025-12-26 (Fri, 26 Dec 2025)
Changed paths:
A JSTests/stress/string-repeat-complex.js
M Source/JavaScriptCore/builtins/StringPrototype.js
M Source/JavaScriptCore/runtime/StringPrototype.cpp
Log Message:
-----------
[JSC] Implement `String#repeat` in C++
https://bugs.webkit.org/show_bug.cgi?id=304631
Reviewed by Yusuke Suzuki.
This patch changes to implement `String#repeat` in C++.
Previously, `String#repeat` only allocated a sequential buffer without building
a rope string
when the original string length was 1. This patch changes the behavior to
allocate a sequential
buffer even when the length is not 1, as long as the resulting string is short
enough.
TipOfTree
Patched
string-repeat-not-resolving-fixed 0.8174+-0.0664 ?
0.8587+-0.0355 ? might be 1.0505x slower
string-repeat-single-resolving 1.7876+-0.1402
1.6992+-0.0705 might be 1.0520x faster
string-repeat-small-resolving 1.1884+-0.0411 ^
0.7413+-0.0943 ^ definitely 1.6031x faster
string-repeat-resolving-no-inline 1.5253+-0.2846 ^
1.0961+-0.0468 ^ definitely 1.3916x faster
string-repeat-single-not-resolving 1.7091+-0.1271
1.5642+-0.0656 might be 1.0926x faster
string-repeat-small-not-resolving 1.1239+-0.0927 ?
1.1445+-0.0643 ? might be 1.0184x slower
string-repeat-not-resolving 1.3078+-0.1511 ?
1.3150+-0.0577 ?
string-repeat-arith 5.5090+-0.2520 !
6.5450+-0.0464 ! definitely 1.1881x slower
string-repeat-not-resolving-no-inline 1.3218+-0.0293 ?
1.3260+-0.0629 ?
string-repeat-resolving-fixed 1.9260+-0.3135 ^
0.9126+-0.0318 ^ definitely 2.1104x faster
string-repeat-resolving 1.5575+-0.1956 ^
1.1582+-0.0874 ^ definitely 1.3448x faster
string-repeat-single-japanese 3.8928+-0.1288
3.8227+-0.0975 might be 1.0183x faster
string-repeat-single-emoji 1.1680+-0.0333
1.1477+-0.0139 might be 1.0177x faster
string-repeat-single-ascii 1.8143+-0.2555
1.7250+-0.1485 might be 1.0517x faster
Test: JSTests/stress/string-repeat-complex.js
* JSTests/stress/string-repeat-complex.js: Added.
(shouldBe):
(throw.new.Error):
(shouldThrow):
(shouldThrow.longStr.repeat):
(shouldBe.test):
* Source/JavaScriptCore/builtins/StringPrototype.js:
(linkTimeConstant.repeatSlowPath): Deleted.
(repeat): Deleted.
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::repeatString):
(JSC::repeatRope):
(JSC::JSC_DEFINE_HOST_FUNCTION):
Canonical link: https://commits.webkit.org/304955@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications