Bug 294097
| Summary: | [JSC] Skip contains hole check in `Array#toReversed` for Contiguous / Int32 array | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Sosuke Suzuki <sosuke> |
| Component: | JavaScriptCore | Assignee: | Sosuke Suzuki <sosuke> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Sosuke Suzuki
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 | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Sosuke Suzuki
Pull request: https://github.com/WebKit/WebKit/pull/46398
EWS
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
<rdar://problem/152919551>