I was talking to a friend today.. and he told me something that I don't know if it is true, so I decided to ask it here.
He has this huge matrix where he has items like this:
1 2 3 4 .. 1000
1001 ...... 2000
2001 ...... 3000
....
Anyway.. he was saying that it is more efficient to traverse it 1 2 3 4.. in C, because in C the array is stored in memory row by row. He tested this in code once for traversing one of this huge structures column by column and row by row, and the times were different. One being more efficient than the other.
but I was thinking how could this make a difference...
I mean it takes the same time to access *(i+1) and *(i+1000) in a contiguous array of memory. right?
Ted