Manikavelu Velayutham

Manikavelu Velayutham

  • 250
  • 7.6k
  • 2.5m

Performance Clarfication - Iterating Objects Property Inside Another Objects - Like Object as a tree

Sep 13 2010 6:40 AM

I have provided the sample code to assign the values in two different methods.
Can any one justify me which method will execute fastter and the reason behind it ?
 
Method 1
for (i=0;i <objD.length;i+=)
{
objnew.APEID = objD[i].APEID;
objnew.APEName= objD[i].APEName;
objnew.APEClass= objD[i].APEClass;
objnew.APESubject= objD[i].APESubject;
objnew.APESection= objD[i].APESection;
objnew.APEYear= objD[i].APEYear;
}
 
Method 2
for (i=0;i <objD.length;i+=)
{
object objData = objD[i];
objnew.APEID = objData .APEID;
objnew.APEName= objData .APEName;
objnew.APEClass= objData .APEClass;
objnew.APESubject= objData .APESubject;
objnew.APESection= objData .APESection;
objnew.APEYear= objData .APEYear;
}

Answers (1)