Neil Carlson said:
> This is an interesting question, and there is one aspect that isn't
> addressed in this response. The reference to MATMUL almost certainly
> results in a call to a library procedure that isn't inlined.
Well, I know of at least one compiler where this statement is false,
i.e. MATMUL is inlined (and blocked for cache/vm effects...)
> I've
> always believed (I don't know where I picked this up, or if it's even
> true) that procedure references usually end up trashing cache contents
> because there is actually a lot of stuff that goes on behind the scenes
> during procedure calls and returns (saving/restoring the stack, etc.)
Unlikely. Depends on the size of the cache - but recent machines have
megabytes of cache and only a few dozen registers to save.
Even on the ancient and creaking R3000 MIPS machine I am typing this on,
the data cache is 32K; saving a few registers is not going to do a lot
to that. Unless the compiler-writer goes out of their way to have an
inefficient calling convention that are unlikely to trash more than a
small number of KB.
The cache that gets trashed more thoroughly on procedure references is the
instruction cache which is often much smaller than the data cache. But
that is immaterial since virtually all of the MATMUL time is spent
executing the loop next - after the first trip the entire loop will be in
cache.
Cheers,
--
...........................Malcolm Cohen, NAG Ltd., Oxford, U.K.
([log in to unmask])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|