for let index vs for of entries

Benchmark created on


Setup

const array = Array.from({ length: 10_000 }, (_, i) => i);

Test runner

Ready to run.

Testing in
TestOps/sec
for
for (let i = 0; i < array.length; i++) {
	const item = array[i];
}
ready
for of entries
for (const [i, item] of array.entries()) {}
ready

Revisions

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