RESOLVED FIXED294097
[JSC] Skip contains hole check in `Array#toReversed` for Contiguous / Int32 array
https://bugs.webkit.org/show_bug.cgi?id=294097
Summary [JSC] Skip contains hole check in `Array#toReversed` for Contiguous / Int32 a...
Sosuke Suzuki
Reported 2025-06-05 17:50:14 PDT
Previously, the fast path for `Array.prototype.toReversed` first checked whether the source array was holey and then copied the contents with a `memcpy`. This patch replaces the `memcpy` with `copyArrayElements`, which already handles holey arrays, eliminating the upfront hole-detection branch. As a result, `Array#toReversed` is 3x ~ 4x faster for holey arrays and 1.1x ~ 1.3x faster for packed arrays. However, `copyArrayElements` does not support holey double arrays yet, so this optimization currently applies only to Int32 / contiguous element kinds.
Attachments
Sosuke Suzuki
Comment 1 2025-06-05 17:51:31 PDT
EWS
Comment 2 2025-06-10 00:36:33 PDT
Committed 296030@main (efffcbcdef86): <https://commits.webkit.org/296030@main> Reviewed commits have been landed. Closing PR #46398 and removing active labels.
Radar WebKit Bug Importer
Comment 3 2025-06-10 00:37:21 PDT
Note You need to log in before you can comment on or make changes to this bug.