When I use inside for loops arr(j, i) = 5 it's 10-times slower than arr(i, j) = 5 why?
Dim x As Integer = 10000
Dim arr(x, x) As Integer
Dim watch As Stopwatch
watch = Stopwatch.StartNew()
For i As Integer = 0 To x
For j As Integer = 0 To x
arr(j, i) = 5
Next
Next
watch.Stop()
' arr(i, j) = 5 => TIME: 187
' arr(j, i) = 5 => TIME: 1615
Console.WriteLine(watch.Elapsed.TotalMilliseconds())