Array Copy Test (v2)

Revision 2 of this benchmark created on


Setup

const testSize = 100 * 1000;
const inputArray = new Array(testSize);
for (let i=0; i<testSize; i++) {
	inputArray[i] = (i * 83459 + 21671) % 32513;
}

Test runner

Ready to run.

Testing in
TestOps/sec
const arr - push method
const newArray = [];

for (let i = 0; i < testSize; i++){
	newArray.push(inputArray[i]*2);
}
ready
const arr - assign method
const newArray = Array(testSize);

for (let i = 0; i < testSize; i++){
	newArray[i] = inputArray[i]*2;
}
ready
typed array
const newArray = new Uint32Array(testSize);

for (let i = 0; i < testSize; i++){
	newArray[i] = inputArray[i]*2;
}
ready

Revisions

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