Here is simple C++ code that compare iterating 2D array row major with column major.
#include #include using namespace std; c
The short answer is CPU caches. Scott Mayers explains it very clearly here