C# has a high performance array copying function to copy arrays in place:
Array.Copy(source, destination, length)
It's faster than doing it manually ie.:
for (var i = 0; i < length; i++)
destination[i] = source[i];
I am looking for an equivalent high performance copy function to copy arrays in place, for Int32Array
and Float32Array
in JavaScript and can find no such function:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
The closest is copyWithin
which only does a copy internally within an array.
Is there a built in high performance copy function for TypedArray
s in place?
Plan B, is there a built in high performance clone function instead? (EDIT: looks like slice()
is the answer to that)