Object keys iteration (v116)

Revision 116 of this benchmark created on


Description

This should be just the fastest and incremental ones.

Setup

var data = {}; 
  
for (let i = 0; i < 100; i++) {
	if(i%2 === 0){
		data[i] =  { foo: 'bar ' + i, bar: null };
	}
	else{
		data[i] =  [(Math.random()*73),'ok'];
	}
}

Test runner

Ready to run.

Testing in
TestOps/sec
Chaced for
for (let keys = Object.keys(data), i = 0; i < keys.length; ++i) {
    data[keys[i]];
}
ready
Chaced while
let keys = Object.keys(data), len = keys.length, i = 0;
while (i < len) {
  data[keys[i]];
  i++;
}
ready

Revisions

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