Skip to content

Commit 55e793d

Browse files
committed
Faster concat.
1 parent 1e56c03 commit 55e793d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Data/Array.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ exports.reverse = function (l) {
188188
};
189189

190190
exports.concat = function (xss) {
191+
if (xss.length <= 10000) {
192+
// This method is faster, but it crashes on big arrays.
193+
// So we use it when can and fallback to simple variant otherwise.
194+
return Array.prototype.concat.apply([], xss);
195+
}
196+
191197
var result = [];
192198
for (var i = 0, l = xss.length; i < l; i++) {
193199
var xs = xss[i];

0 commit comments

Comments
 (0)