Prefer slice for copying arrays
freaktechnik opened this issue · 2 comments
freaktechnik commented
Array.from etc. are probably slower. Need to investigate.
freaktechnik commented
Made a little test case for peace of mind: https://jsperf.com/array-cloning-freak/1
The ranking is as follows (checked in Chromium and Firefox, so we have V8 and SpiderMonkey):
Array.prototype.sliceReflect.construct(ArrayArray.prototype.map(performs better than Reflect.construct in SpiderMonkey)- Everything else, like spreading or
Array.from... (far slower)
freaktechnik commented
This should actually be a rule where the user can choose their preferred method.