Loop performance (v3)

Revision 3 of this benchmark created on


Setup

var setup = {};
setup.items = [];
setup.count = 0;
setup.length = 100000
for(const i = 0; i < length; i++) {
	setup.items.push({ a: 'test', b: i });
}

Test runner

Ready to run.

Testing in
TestOps/sec
key in
for(const key in setup.items){
	const item = setup.items[key]
}
ready
for i
for(i = 0; i < length; i++) {
	const item = setup.items[i];
}
ready
for of
for(const item of setup.items) {
}
ready
while inverted
let count = setup.count;
while(count--) {
	const item = setup.items[count];
}
ready

Revisions

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