For loop or while loop - which one is more efficient?

In your benchmark code uv is a global variable. IIRC, those are lazy, so the time measured for T1 includes the time spent creating the array.

8 Likes