Array copy (v4)

Revision 4 of this benchmark created on


Description

Cloning arrays

Setup

var acc = 0;
var W = 100;
var size = W * W;
var typed = new Int32Array(size);
crypto.getRandomValues(typed);
var array = [...typed];

Test runner

Ready to run.

Testing in
TestOps/sec
TypedArray
const typed2 = typed.slice();
for (let x = 0; x < size; x++) {
  acc += typed2[x];
}
ready
array[]
const array2 = [...array];
for (let x = 0; x < size; x++) {
  acc += array2[x];
}
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.