The mystery of 1d array and 2d array continues...
array_1d vs. array_2d ...
I finally found out why obsture code like array_1d is used throughout. His ration is, array_1d needs to access the memory once while array_2d while accesses twice; calculation is faster than accessing memory.
I really beat to differ under normal circumstances, i.e. no swap is involved. Should I still run stupid experiment to prove me conjecture?
double array_1d[ X * Y ]; array_id[ i*X + j] = ....
double array_2d[X][Y]; array_2d[i][j] = ....
-- mr blog
<< Home