Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a4df93500a72428a2220aa1282f4801dced50471
https://github.com/WebKit/WebKit/commit/a4df93500a72428a2220aa1282f4801dced50471
Author: Sosuke Suzuki <[email protected]>
Date: 2026-08-12 (Wed, 12 Aug 2026)
Changed paths:
A JSTests/microbenchmarks/array-join-int32-separator.js
A JSTests/stress/array-join-int32-separator.js
M Source/JavaScriptCore/dfg/DFGOperations.cpp
M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
M Source/JavaScriptCore/runtime/ArrayPrototypeInlines.h
M Source/JavaScriptCore/runtime/JSStringJoiner.cpp
M Source/JavaScriptCore/runtime/JSStringJoiner.h
Log Message:
-----------
[JSC] `Array#join` on Int32 arrays should use `JSOnlyStringsAndInt32sJoiner`
for any separator
https://bugs.webkit.org/show_bug.cgi?id=321228
Reviewed by Yusuke Suzuki.
295918@main taught JSOnlyStringsAndInt32sJoiner to write Int32 elements
directly into the result buffer, but fastArrayJoin's ALL_INT32_INDEXING_TYPES
case was not updated and still went through the generic JSStringJoiner,
allocating a numeric string per element. Only the empty-separator case was
fast because arrayProtoFuncJoin has its own early path, so `ids.join("")`
was ~2x faster than `ids.join(",")` / `ids.toString()`.
This patch makes the ALL_INT32 case try JSOnlyStringsAndInt32sJoiner first,
mirroring the ALL_CONTIGUOUS case, and falls back to the generic loop only
when the array has holes.
tryJoin is now templatized on the indexing shape so that the Int32Shape
instantiation only checks for holes and skips the per-element isString() checks
that the ContiguousShape one needs.
baseline patched
array-join-int32-separator 22.1538+-0.6142 ^ 10.9635+-0.7135
^ definitely 2.0207x faster
Tests: JSTests/microbenchmarks/array-join-int32-separator.js
JSTests/stress/array-join-int32-separator.js
* JSTests/microbenchmarks/array-join-int32-separator.js: Added.
(next):
(test):
* JSTests/stress/array-join-int32-separator.js: Added.
(shouldBe):
(test):
* Source/JavaScriptCore/runtime/ArrayPrototypeInlines.h:
(JSC::fastArrayJoin):
Canonical link: https://commits.webkit.org/319022@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications