Skip to content

Commit 60b7e2e

Browse files
authored
Merge pull request #94 from dikmax/faster-concat
Faster concat.
2 parents 1cb437b + 55e793d commit 60b7e2e

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
@@ -203,6 +203,12 @@ exports.reverse = function (l) {
203203
};
204204

205205
exports.concat = function (xss) {
206+
if (xss.length <= 10000) {
207+
// This method is faster, but it crashes on big arrays.
208+
// So we use it when can and fallback to simple variant otherwise.
209+
return Array.prototype.concat.apply([], xss);
210+
}
211+
206212
var result = [];
207213
for (var i = 0, l = xss.length; i < l; i++) {
208214
var xs = xss[i];

0 commit comments

Comments
 (0)