I've recently been reviewing code an noticed the use of this syntax in a for loop
for(int i = 0, len = myArray.length; i < len; i++){
//some code
}
as opposed to:
for(int i = 0; i < myArray.length; i++){
//some code
}
With the reasoning that it is more efficient as you don't have to keep looking up the myArray.length property with each loop.
I created a test to check if this was the case, and in all my tests the first for loop approach was significantly (around 70%) faster than the second.
I was curious why this syntax isn't more widely adopted and that i'm correct in thinking it is a better approach to using a for loop through an array.