-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Add __spreadArrays helper #31166
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add __spreadArrays helper #31166
Conversation
@typescript-bot perf test |
Heya @rbuckton, I've started to run the perf test suite on this PR at 528601f. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
@rbuckton Here they are:Comparison Report - master..31166
System
Hosts
Scenarios
|
528601f
to
a451953
Compare
What about speedup var __spreadArrays = function () {
for (var i = 0, l = 0, al = arguments.length; i < al; ++i)
l += arguments[i].length;
for (var ar = new Array(l), i = 0, k = 0; i < al; ++i)
for (var j = 0, a = arguments[i], jl = a.length; j < jl; ++j, ++k)
ar[k] = a[j];
return ar;
}; On V8 7.4 this faster by ~3x-6x for large (> 1k) arrays. Bench link: |
} | ||
} | ||
|
||
function isPackedElement(node: Expression) { | ||
return !isOmittedExpression(node); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const innerSpreadEmpty = [1, 2, ...[...[,,,]]]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It basically catches [...[1, 2]]
and turns it into [1, 2]
rather than calling the helper.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@typescript-bot test this |
Verified that the only differences in our RWC suite are expected. |
Adds a
__spreadArrays
helper for a more accurate spread behavior when not using--downlevelIteration
.Fixes #8856