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.
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.
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.