Let assume I have to execute a code which consist five nested for
loops. Let call them:
- A - 10 iterations (elements)
- B - 15 iterations (elements)
- C - 16 iterations (elements)
- D - 20 iterations (elements)
- E - 100 iterations (elements)
Is there any difference between when I loop them in this order:
A(B(C(D(E()))))
and
E(D(C(B(A()))))?
Or maybe different order of the loops is optimal?
My question is language independent. I'd like to know how to approach to assess the cost of this code, to write the most optimum (fast) one.
Are there any difference in the calling (iterating) cost, depending on the order of size of the loop, or not?
Where to start looking to solve and get know more about this kind of problem(s)?