Building DMD with DMD or LDC

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 16 03:06:54 PDT 2016


On Saturday, 15 October 2016 at 07:39:31 UTC, ketmar wrote:
> On Friday, 14 October 2016 at 15:13:58 UTC, Jonathan M Davis 
> wrote:
>> On Thursday, October 13, 2016 19:07:44 Nordlöw via 
>> Digitalmars-d-learn wrote:
>>> Is there a large speed difference in compilation time 
>>> depending on whether the DMD used is built using DMD or LDC?
>>
>> I would be shocked if there weren't.
> i did that out of curiosity some time ago, but with gdc, and 
> then tested my projects, and phobos rebuilding. speed 
> difference was so small that it can be a usual random deviation.

This topic came up at the start of the year, and Iain pointed out 
that the compiler code overrides the default memory management, 
which increases performance enormously. But, that malloc override 
was _only enabled when built with DMD_.
https://forum.dlang.org/post/vqjzqadpxwfzvlptpypz@forum.dlang.org

This was fixed for LDC here: 
https://github.com/dlang/dmd/pull/5631/files
It resulted in a massive speed gain when the front-end is built 
with LDC.

I no longer have the numbers, but DMD built with LDC is 
definitely faster. About 10% according to the old thread. Same 
for LDC built with LDC.
(self promotion: when you compile the same code over and over, 
you gain another ~7%  when using PGO: 
https://johanengelen.github.io/ldc/2016/04/13/PGO-in-LDC-virtual-calls.html)

-Johan


More information about the Digitalmars-d-learn mailing list