TypedArray.prototype.set() vs. unrolled loop

Benchmark created on


Setup

const buffer1 = new ArrayBuffer(10000);
const arr1 = new Float32Array(buffer1);

const buffer2 = new ArrayBuffer(8000);
const arr2 = new Float32Array(buffer2);
for (let i = 0; i < arr2.length; ++i) {
	arr2[i] = Math.random();
}

Test runner

Ready to run.

Testing in
TestOps/sec
TypedArray.prototype.set()
arr1.set(arr2);
ready
Unrolled loop
for (let i = 0; i < arr2.length; ++i) {
	arr1[i] = arr2[i];
}
ready

Revisions

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