Optimize my code =)
Stanislav Blinov
stanislav.blinov at gmail.com
Tue Feb 18 01:05:32 PST 2014
On Tuesday, 18 February 2014 at 08:50:23 UTC, bearophile wrote:
> Stanislav Blinov:
>
>>>> LDC yields roughly the same times.
>>>
>>> This is surprising.
>>
>> To me as well. I haven't yet tried to dig deep though.
>
> I have compiled your code with (a single module, 32 bit
> Windows):
>
> dmd -wi -vcolumns -O -release -inline -noboundscheck matrix3.d
> ldmd2 -wi -O -release -inline -noboundscheck matrix3.d
>
> DMD:
>
> multiplicationTest ...
> Time required: 4 secs, 665 ms, 452 ╬╝s, and 2 hnsecs
>
> LDC2:
>
> multiplicationTest ...
> Time required: 2 secs, 522 ms, and 747 ╬╝s
Interesting. For me (on 64 bit) multiplicationTest is in the same
league for DMD and LDC. (I'm still using dmd 2.064.2 as my main
dmd install btw).
But what is up with those first and last tests in LDC?..
$ rdmd -wi -O -release -inline -noboundscheck main.d
allocationTest ...
Time required: 1 sec, 165 ms, 766 μs, and 1 hnsec
multiplicationTest ...
Time required: 1 sec, 232 ms, 287 μs, and 4 hnsecs
toStringTest ...
Time required: 997 ms, 217 μs, and 1 hnsec
transposeTest ...
Time required: 859 ms, 152 μs, and 5 hnsecs
scalarMultiplicationTest ...
Time required: 105 ms, 366 μs, and 5 hnsecs
matrixAddSubTest ...
Time required: 241 ms, 705 μs, and 8 hnsecs
matrixEqualsTest ...
Time required: 243 ms, 534 μs, and 8 hnsecs
identityMatrixTest ...
Time required: 260 ms, 411 μs, and 4 hnsec
$ ldmd2 -wi -O -release -inline -noboundscheck main.d
neolab/core/dimension.d neolab/core/matrix.d -ofmain-ldc &&
main-ldc
allocationTest ...
Time required: 2 hnsecs (o_O)
multiplicationTest ...
Time required: 1 sec, 138 ms, 628 μs, and 2 hnsecs
toStringTest ...
Time required: 704 ms, 937 μs, and 5 hnsecs
transposeTest ...
Time required: 859 ms, 413 μs, and 5 hnsecs
scalarMultiplicationTest ...
Time required: 103 ms, 250 μs, and 2 hnsecs
matrixAddSubTest ...
Time required: 226 ms, 955 μs, and 3 hnsecs
matrixEqualsTest ...
Time required: 470 ms and 186 μs
identityMatrixTest ...
Time required: 4 hnsecs (o_O)
More information about the Digitalmars-d-learn
mailing list