|
|
|
|
|
by olliej
2584 days ago
|
|
The problem is making concat fast given the original array still exists and is mutable. In the major JS engines string concat is essentially O(1) because strings are immutable (and they flatten them out as appropriate according to whatever heuristics make sense). But for array concatenation in js i can do a.concat(b) Followed by a[0]=something Or Delete a[1] Or A.push(something) Or a.length++ Etc To make this particular array concat fast would require significant perf impact to all other arrays, even those that aren’t involved in concat |
|