Loop performance (v6)

Revision 6 of this benchmark created on


Setup

var setup = {};

setup.items = [];
setup.object = {};
setup.count = 0;
setup.length = 100000000
setup.set = new Set();
for(const i = 0; i < length; i++) {
	const sample = { a: 'test', b: i };
	setup.items.push(sample);
	setup.object[`test-${i}`] = sample;
	setup.set.add(sample);
}
setup.values = Object.values(setup.object);


Teardown

setup = null;

Test runner

Ready to run.

Testing in
TestOps/sec
item of array
for(const item of setup.values) {
	
}
ready
key in object
for(const key in setup.object) {
	const item = setup.object[key];
}
ready
item of set
for(const item of setup.set) {
	
}
ready

Revisions

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