Building DMD with DMD or LDC

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 14 08:13:58 PDT 2016


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. The dmd backend does a much worse job
at optimization (especially with range-based code). I think that at one
point, it was thought that the difference in compilation speed after
switching dmd to D was about 20% thanks to the backend change (since
previously, it would have been compiled with gcc), and at least initially,
they didn't want to release a version of dmd that used the front-end in D
until it could be built with gdc or ldc, because they didn't want to release
a compiler that was that much slower. I don't know what they actually ended
up doing, but I'd guess that the official dmd releases are currently built
with LDC.

Before the front-end was switched to D, my main machine could build all of
the Phobos unit tests and run them in under 5 minutes, whereas after the
switch to D, it couldn't. So, I definitely noticed the difference on my
machine, but I've never gotten around to setting LDC up on my machine to use
it to compile dmd. Aside from compiling Phobos, I don't have any projects
large enough for it to matter (but it clearly matters on larger projects).

Now, the folks using Windows wouldn't have seen the same performance hit as
those using one of the POSIX OSes (since dmc uses the same backend as dmd),
but presumably, building dmd with LDC on Windows would result in a faster
dmd just like it does on *nix.

- Jonathan M Davis




More information about the Digitalmars-d-learn mailing list