Array performance

Benchmark created on


Description

Array performance

Setup

let a = [];
for (let i = 0x400; i--; a.push(i));

Test runner

Ready to run.

Testing in
TestOps/sec
forEach
a.forEach(item => { console.log(item) })
ready
for...of
for (let i of a) {
	console.log(i);
}
ready
for (length cached)
for (let i = 0, iLen = a.length; i < iLen; i++) {
	console.log(a[i]);
}
ready
for (no length caching)
for (let i = 0; i < a.length; i++) {
	console.log(a[i]);
}
ready

Revisions

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