I am working on optimization of some code and came across this, could someone tell me why this piece of code is more 'optimized'
for (i = 0; i < 1000; i+=2){
float var = numberOfEggs*arrayX[i] + arrayY[i];
arrayY[i+1] = var;
arrayY[i+2] = numberOfEggs*arrayX[i+1] + var;
}
than this version?
for(long i = 0; i < 1000 ; ++i)
arrayY[i+1] = numberOfEggs*arrayX[i] + arrayY[i];
any help is appreciated thank you!