Iterating for-loop normal and undefined (v3)

Revision 3 of this benchmark created on


Setup

for (var items=9999,arr=[],obj={}, i=0, every=0; i<items; ++i) {
    
        //if (every++ < 2){
        //if (every++ < 3){
        //if (every++ < 10){
      //      arr[i]=i;
      //      obj[i]=i;
        //}
        //else every = 0;
    
        if (i>9000){
            arr[i]={};
            obj[i]={};
      }
        else {
            arr[i]=false;
      }
    }

Test runner

Ready to run.

Testing in
TestOps/sec
Array
for (i=0; i<items;i++) {
        if (typeof arr[i] == 'object')
                arr[i];
}
ready
Array for-in
for (i in arr) {
        if (typeof arr[i] == 'object')
                arr[i];
}
ready
Object
for (i in obj)
        obj[i];
ready

Revisions

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