You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a4df935
Browse filesBrowse the repository at this point in the historyBrowse files
[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
0 commit comments