Compare Arrays

Benchmark created on


Setup

const array1 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
const array2 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 11];

Test runner

Ready to run.

Testing in
TestOps/sec
Comparison by for loop
for (let i = 0; i < 10; ++i) {
	if (array1[i] !== array2[i]) return false;
}

return true;
ready
Comparison by Array.prototype.every
return array1.every((item, index) => item === array2[index]);
ready

Revisions

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