Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 29e5f281e3273d83748455fb6d3325e7722a8b31
https://github.com/WebKit/WebKit/commit/29e5f281e3273d83748455fb6d3325e7722a8b31
Author: Yusuke Suzuki <[email protected]>
Date: 2023-10-23 (Mon, 23 Oct 2023)
Changed paths:
A JSTests/microbenchmarks/array-from-array.js
M Source/JavaScriptCore/builtins/ArrayConstructor.js
M Source/JavaScriptCore/builtins/BuiltinNames.h
M Source/JavaScriptCore/bytecode/LinkTimeConstant.h
M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
M Source/JavaScriptCore/runtime/ArrayPrototype.h
M Source/JavaScriptCore/runtime/JSGlobalObject.cpp
Log Message:
-----------
[JSC] Add Array.from(Array) fast path
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
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes