If there are two object definitions and one of the objects has a lot more properties than the other -
Example objects:
var personObjectType1 =
{
name: [a string],
age: [an int]
};
var personObjectType2 =
{
name: [a string],
age: [an int],
address: [a string],
photo: [a link],
spouse: [a string],
cars: [an array of strings],
children: [an array of strings],
pets: [an array of strings],
father: [a string],
mother: [a string],
birthdate: [a date]
};
And you have an equal length array of each of those objects, will looping through the array of objects be faster for the objects with fewer properties?
(NOTE: The same action is being performed on each type of object)
Example code:
//personObjectType1Array is an array of 10000 personObjectType1's
//personObjectType2Array is an array of 10000 personObjectType2's
for (var i = 0; i < personObjectType1Array.length; i++)
{
console.log(personObjectType1Array[i].age);
}
for (var j = 0; j < personObjectType2Array.length; j++)
{
console.log(personObjectType2Array[i].age);
}
Would one loop run faster than the other? Why or why not?
EDIT: Responses are saying that there is no difference, can anyone say why?