On Wed, 20 Mar 2002, Gordon Pearce wrote: > > > > > > Why will it be faster? Is it something to do with the way the array is > > > referenced? > > > > From the previous two email, yep, that's pretty much what I thought. > I never thought about the cache thing though. I wonder if it makes a > difference with no cache? > I think an experiment is in order...
Well, you could also get a difference from another effect, if your arrays are large. Think virtual memory. If your arrays take a number of pages larger than the number of slots in the TLB (the TLB is a fast cache for page table lookups, ie virtual->physical address lookups), then wandering back and forth through memory will cause extra memory accesses to re-fetch the entries that are pushed out of the TLB. Anyway, that's not going to happen with the 10x10 example array... -- Nicholas Wolverson -------------------------------------------------------------------- http://www.lug.org.uk http://www.linuxportal.co.uk http://www.linuxjob.co.uk http://www.linuxshop.co.uk --------------------------------------------------------------------
