Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 4cd20629601f53916b5afc75bf2c3bac83980f66
https://github.com/WebKit/WebKit/commit/4cd20629601f53916b5afc75bf2c3bac83980f66
Author: Sosuke Suzuki <[email protected]>
Date: 2024-09-14 (Sat, 14 Sep 2024)
Changed paths:
A JSTests/microbenchmarks/iterator-prototype-toArray-for-array.js
A JSTests/stress/iterator-prototype-toArray-empty.js
M Source/JavaScriptCore/runtime/ArrayPrototype.cpp
M Source/JavaScriptCore/runtime/ArrayPrototypeInlines.h
M Source/JavaScriptCore/runtime/JSArray.cpp
M Source/JavaScriptCore/runtime/JSArray.h
M Source/JavaScriptCore/runtime/JSArrayInlines.h
M Source/JavaScriptCore/runtime/JSIteratorPrototype.cpp
Log Message:
-----------
[JSC] Add fast path for `Iterator.prototype.toArray`
https://bugs.webkit.org/show_bug.cgi?id=279489
Reviewed by Yusuke Suzuki.
This patch adds a fast path for `Iterator.prototype.toArray.call(Array)`. It
uses the same logic as
the already existing fast path for `Array.from(Array)`[1].
With this patch, performance on microbenchmarks improves by approximately 2.3x.
TipOfTree Patched
iterator-prototype-toArray-for-array 0.7119+-0.0159 ^
0.3019+-0.0052 ^ definitely 2.3578x faster
Even though this patch shares some code with `Array.from`, there are no
performance regressions.
TipOfTree Patched
array-from-array 0.3007+-0.0145 0.2976+-0.0057
might be 1.0103x faster
array-from-arraylike 29.8513+-0.4606 ^ 29.1788+-0.1179 ^
definitely 1.0230x faster
[1]: https://commits.webkit.org/269690@main
* JSTests/microbenchmarks/iterator-prototype-toArray-for-array.js: Added.
* JSTests/stress/iterator-prototype-toArray-empty.js: Added.
(shouldBe):
(throw.new.Error):
(else.shouldBe):
* Source/JavaScriptCore/runtime/ArrayPrototype.cpp:
(JSC::concatAppendOne):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::moveElements): Deleted.
(JSC::clearElement): Deleted.
(JSC::copyElements): Deleted.
* Source/JavaScriptCore/runtime/ArrayPrototypeInlines.h:
(JSC::getProperty): Deleted.
* Source/JavaScriptCore/runtime/JSArray.cpp:
(JSC::clearElement):
* Source/JavaScriptCore/runtime/JSArray.h:
(JSC::moveArrayElements):
(JSC::clearElement):
(JSC::copyArrayElements):
* Source/JavaScriptCore/runtime/JSArrayInlines.h:
(JSC::getProperty):
* Source/JavaScriptCore/runtime/JSIteratorPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
Canonical link: https://commits.webkit.org/283672@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes