Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: ff70a7d009687d6a8a88ce87a6ae6f9c698c6817
https://github.com/WebKit/WebKit/commit/ff70a7d009687d6a8a88ce87a6ae6f9c698c6817
Author: Sosuke Suzuki <[email protected]>
Date: 2026-01-01 (Thu, 01 Jan 2026)
Changed paths:
A JSTests/microbenchmarks/array-from-set-double-large.js
A JSTests/microbenchmarks/array-from-set-double-small.js
A JSTests/microbenchmarks/array-from-set-int-large.js
A JSTests/microbenchmarks/array-from-set-int-small.js
A JSTests/microbenchmarks/array-from-set-object-large.js
A JSTests/microbenchmarks/array-from-set-object-small.js
A JSTests/stress/array-from-set.js
M Source/JavaScriptCore/runtime/ArrayConstructor.cpp
Log Message:
-----------
[JSC] Add fast path for Array.from(set)
https://bugs.webkit.org/show_bug.cgi?id=304804
Reviewed by Yusuke Suzuki.
This patch adds a fast path for `Array.from(set)` similar to the existing
fast path for `Array.from(arguments)` (PR #53657).
When a Set's iterator protocol is fast and non-observable, we can directly
iterate over the Set's internal storage using `nextAndUpdateIterationEntry`
instead of going through the JavaScript iterator protocol, significantly
improving performance.
The implementation:
1. Checks if the Set's iterator protocol is fast and non-observable
2. First pass: scans all elements to determine the optimal indexing type
3. Allocates the result array with the appropriate structure
4. Second pass: copies elements directly to the result array
TipOfTree Patched
array-from-set-double-small 8.6247+-0.4642 ^ 4.2066+-0.1275
^ definitely 2.0503x faster
array-from-set-object-small 8.3607+-0.2015 ^ 3.8586+-0.0723
^ definitely 2.1668x faster
array-from-set-int-small 8.5151+-0.1598 ^ 3.8688+-0.1046
^ definitely 2.2010x faster
array-from-set-object-large 49.8159+-0.9932 ^ 35.2311+-0.6211
^ definitely 1.4140x faster
array-from-set-double-large 53.1368+-2.0365 ^ 37.7437+-0.6627
^ definitely 1.4078x faster
array-from-set-int-large 49.8843+-1.9441 ^ 34.7549+-0.4150
^ definitely 1.4353x faster
* JSTests/microbenchmarks/array-from-set.js: Added.
* JSTests/stress/array-from-set.js: Added.
* Source/JavaScriptCore/runtime/ArrayConstructor.cpp:
(JSC::tryCreateArrayFromSet):
(JSC::arrayConstructorPrivateFromFastWithoutMapFn):
Canonical link: https://commits.webkit.org/305033@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications