Looping (100) (v2)

Revision 2 of this benchmark created on


Setup

const count = 100;
const data = new Array(count);
for (let i = 0; i < count; i++) {
	data[i] = i
}

Test runner

Ready to run.

Testing in
TestOps/sec
forEach
data.forEach((item) => {
	item * 1000
})
ready
for
for (let i = 0; i < data.length; i++) {
	data[i] * 1000
}
ready
for (don't recalc length)
const length = data.length
for (let i = 0; i < length; i++) {
	data[i] * 1000
}
ready
for...of
for (const item of data) {
	item * 1000
}
ready

Revisions

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