How to tune numerical D? (matrix multiplication is faster in g++ vs gdc)

bearophile bearophileHUGS at lycos.com
Mon Mar 4 06:59:20 PST 2013


J wrote:

> @bearophile: Thank you!  Unfortunately the 
> http://codepad.org/B5b4uyBM code runs a bit *slower* than the 
> original D code. Yikes!
>
> $  gdmd -O -inline -release -noboundscheck -m64 bear.d -ofdbear
> $ time ./dbear
> -1015380632 859379360 -367726792 -1548829944
>
> real    2m36.971s
> user    2m36.910s
> sys 0m0.030s
> $ time ./dbear
> -1015380632 859379360 -367726792 -1548829944
>
> real    2m34.425s
> user    2m34.370s
> sys 0m0.020s

A bit better version:
http://codepad.org/jhbYxEgU

I think this code is good compared to the original (there are 
better algorithms). So maybe the introduced inefficiencies are 
small compiler problems worth finding and reporting.

------------------

Manu:

> Does D support proper square array's this way? Or does it just 
> automate allocation of the inner arrays?
> Does it allocate all the associated memory in one block?

Maybe you should take a look at druntime code.

Bye,
bearophile


More information about the Digitalmars-d mailing list