Quote:
Originally Posted by RyanCahoon
I tried reversing the indices and it took 59.1 (vs 11.9) seconds. A couple other websites say Pascal is row-major.
|
Long, long ago I was the support for a Pascal compiler that ran on the Unisys A-Series. That compiler did Row major, since that was the underlying architecture of a stack machine. A 2D array consisted of an array of pointers, each pointer referencing a row. Once you got the row, it was fast to "walk the row" since the elements were contiguous in memory.
Walking the matrix in col order caused two memory accesses per read, one for the pointer (and the time to do the reference fetch) and the read of the data elements. You could see a -10x reduction in speed doing column order vs row order. -- Thanks for the "back when" reminder.
Ether: Just for grins, I tried RLab on our 16 way cluster. For some reason I'm not getting responses to tic()/toc(); What Windows OS are you running RLab under?