On Mon, 29 Mar 2004, Boris Herman wrote: [..]
My program doesn't really do anything much - it performs gazillions of computations in arrays that all together consume less than 20 Mb of memory.
20 Mb is several times the size of your L2 cache. The cpu uses only the cache with a portion of the program plus some of the data in the cache, so if the data the program needs isn't in the chunk of data in the cache the cpu does a store & load cache operation.
For example, this simple program took 1.8 sec to run:
program huge; var i,j : integer; BA : array [ 1..10000, 1..10000 ] of integer; begin for i := 1 to 10000 do for j := 1 to 10000 do BA [ i,j ] := i+j; end.
Change one line to read: BA [ j,i ] := i+j; and the program now takes 27 sec to run
Hope this helps, Russ