Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4e93b58dfd8e91ebdb3159fd872d98382cf8c563
https://github.com/WebKit/WebKit/commit/4e93b58dfd8e91ebdb3159fd872d98382cf8c563
Author: Sosuke Suzuki <[email protected]>
Date: 2026-07-08 (Wed, 08 Jul 2026)
Changed paths:
A JSTests/microbenchmarks/join-template-literal-parts.js
A JSTests/stress/array-join-rope-elements.js
M Source/JavaScriptCore/runtime/JSStringJoiner.cpp
Log Message:
-----------
[JSC] `Array#join` should write rope elements directly into the result buffer
https://bugs.webkit.org/show_bug.cgi?id=318840
Reviewed by Keith Miller.
Array#join's fast path resolves each rope element via view(), allocating a
throwaway flat StringImpl per element and copying the characters twice.
This patch makes the write loop use JSString::resolveToBuffer instead, which
walks rope fibers and writes into the preallocated result buffer without
allocating. Since resolveToBuffer cannot throw, the per-element exception
checks are also gone.
baseline patched
join-template-literal-parts 64.6259+-0.7114 ^ 41.6549+-0.8681
^ definitely 1.5515x faster
Tests: JSTests/microbenchmarks/join-template-literal-parts.js
JSTests/stress/array-join-rope-elements.js
* JSTests/microbenchmarks/join-template-literal-parts.js: Added.
(build):
* JSTests/stress/array-join-rope-elements.js: Added.
(shouldBe):
(test):
* Source/JavaScriptCore/runtime/JSStringJoiner.cpp:
(JSC::joinStrings):
Canonical link: https://commits.webkit.org/316791@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications