Loop performance (v2)

Revision 2 of this benchmark created on


Setup

let dictionary = {};
let count = 0;
let length = 100000
for(const i = 0; i < length; i++) {
	dictionary[i] = { a: 'test', b: i };
}

Test runner

Ready to run.

Testing in
TestOps/sec
With
for(const key in dictionary){
	const item = dictionary[key]
	count++;
}
ready
Without
const values = Object.values(dictionary);

for(i = 0; i < length; i++) {
	const item = values[i];
	count++;
}
ready

Revisions

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