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 29e5f28
Browse filesBrowse the repository at this point in the historyBrowse files
https://bugs.webkit.org/show_bug.cgi?id=263490
rdar://117290480
Reviewed by Michael Saboff.
This patch adds Array.from fast path for simple arrays without callbacks, like, `Array.from(array)`.
This is because this pattern can be used for fast array cloning. The fast path is 8.14x faster than
the Array.from generic path.
We should take Array.from fast path when array iterator protocol allows. This ensures that we can iterate
an array without creating an iterator. And it also ensures that our Array prototype chain is sane. So,
we can skip many costly operations and directly copy data.
array-from-array 2.6646+-0.0174 ^ 0.3271+-0.0155 ^ definitely 8.1469x faster
* JSTests/microbenchmarks/array-from-array.js: Added.
* Source/JavaScriptCore/builtins/ArrayConstructor.js:
* Source/JavaScriptCore/builtins/BuiltinNames.h:
* Source/JavaScriptCore/bytecode/LinkTimeConstant.h:
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/ArrayPrototype.h:
* Source/JavaScriptCore/runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
Canonical link: https://commits.webkit.org/269690@main
0 commit comments