@bearophile: Thank you! Unfortunately the http://codepad.org/B5b4uyBM code runs a bit *slower* than the original D code. Yikes!On Monday, 4 March 2013 at 04:22:01 UTC, bearophile wrote:
So this should be better:
http://codepad.org/B5b4uyBM
Bye,
bearophile
$ 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
@John Colvin: here is the disassembly of mmult() in both languages. Unfortunately I'm not literate in x86_64 assembly. Perhaps the problem is obvious to you? All I can really tell is that the g++ version is shorter.
The memory allocation, when timed separately (comment out mmult), is less than 60 msec for either version, so I don't think its a memory issue, although it could be caching issue since the matrix layouts are different.
int[][] m = new int[][](rows, cols);