Is someArray[index] a faster way to get to a value than someObject.field?
E.G.:
if(intArray[i] == 42) {//do stuff}
VS
if(someObject.x == 42) {//do stuff}
I will try to test it soon and post the results; just wondering if you all had any thoughts.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would expect the using the array element to be a lot quicker since the reference points directly to the value to be retrieved.
When you reference a member on an Object field, the runtime has to determine which class the member belongs to and so on, and the process will take longer.