Two Loops Performance Difference. Swapping Inner And Outer Loop
I had two loops (one nested in the other one) and I was wondering if there is any difference in how I nest these loops. Results of Code 1 and Code 2 are the same (100,000x4 = 4x100
Solution 1:
The difference is in the loop initialization code. The first code has to initialize the inner loop 100,000 times while the second one only does that 4 times.
Post a Comment for "Two Loops Performance Difference. Swapping Inner And Outer Loop"