DMD is slow for matrix maths?

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 29 01:24:05 PDT 2015


On 27 Oct 2015 9:15 pm, "David Nadlinger via Digitalmars-d" <
digitalmars-d at puremagic.com> wrote:
>
> On Tuesday, 27 October 2015 at 18:19:38 UTC, Etienne Cimon wrote:
>>
>> On Tuesday, 27 October 2015 at 18:18:36 UTC, Etienne Cimon wrote:
>>>
>>> LDC couldn't inline it either. My only options at this point is to
write the assembly or link to a C library.
>>
>>
>> Btw, DMD and LDC had similar performance.
>
>
> This would be very strange in numerical code. Are you building all the
relevant modules at once, and with `ldc2 -singleobj` or `ldmd` (which
enables -singleobj by default)? LDC will not do cross-module inlining
otherwise.
>
>  — David

There was a recent talk on optimisations using a sumMatrix function and
about 9 variants of it.  Unfortunately the graphs of LDC didn't fit the
screen, but the speaker assured there was nothing interesting to see (for
the most part, the half graphs of LDC only started to look more performant
than DMD when vectors started being used).

Ignoring the vector implementations, it was found that DMD did best when
the loop was hand unrolled, and GDC outperformed the vectorized versions
(and all other compilers) by using an obscure one-liner combination of
std.algorithm functions with unsafe math optimisations turned on.

std.algorithm.sum was the slowest of the bunch.

I'll have to see if anything was published.

Iain.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20151029/248e20df/attachment.html>


More information about the Digitalmars-d mailing list