Matrix mul

Don nospam at nospam.com
Sat Nov 22 22:22:27 PST 2008


bearophile wrote:
> While writing code that works on matrices I have found something curious...

Here's what I think is going on. AFAIK, D hasn't got any special code 
for initializing jagged arrays. So
         auto A = new double[][](N, N);
involves N+1 memory allocations.
As well as being slow, this is going to give horrible locality of 
reference in the memory allocation. You'll suffer cache misses on almost 
every array access!

I don't think this has anything to do with bounds checking.



More information about the Digitalmars-d mailing list