www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - dmd-built dmd is faster that ldc-built dmd or gdc-built dmd?

reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
Hi,

In the process of setting up a new development environment, I 
noticed that DMD's codegen seems to outperform GDC's or LDC's 
when building DMD itself.

I wrote a test script to measure the time it takes for DMD (built 
with different compilers) to build Phobos:

http://dump.thecybershadow.net/9e42ff2858d1419cf41108cc50b0a83a/bench.sh

My results are:

dmd: 11.26
ldc: 15.35
gdc: 14.80

Compiler versions:

LDC - the LLVM D compiler (0.17.0):
   based on DMD v2.068.2 and LLVM 3.7.1
gdc (GCC) 5.3.0

GDC/LDC binaries are the ones packaged in Arch Linux. Host DMD is 
the one installed and chosen by AUTO_BOOTSTRAP (2.068.2). Target 
DMD/Phobos is from git master and built with ENABLE_RELEASE=1.

To me this seems surprising, especially considering that on 
Windows I used to get a significant speed increase when building 
DMD with MSVC instead of DMC.
Mar 11 2016
parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On Friday, 11 March 2016 at 13:39:04 UTC, Vladimir Panteleev 
wrote:
 Hi,

 In the process of setting up a new development environment, I 
 noticed that DMD's codegen seems to outperform GDC's or LDC's 
 when building DMD itself.

 I wrote a test script to measure the time it takes for DMD 
 (built with different compilers) to build Phobos:

 http://dump.thecybershadow.net/9e42ff2858d1419cf41108cc50b0a83a/bench.sh

 My results are:

 dmd: 11.26
 ldc: 15.35
 gdc: 14.80
https://github.com/D-Programming-Language/dmd/blob/master/src/root/rmem.d#L166-L193 How memory is allocated makes a huge difference.
Mar 11 2016
parent reply Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Friday, 11 March 2016 at 14:32:26 UTC, Iain Buclaw wrote:
 On Friday, 11 March 2016 at 13:39:04 UTC, Vladimir Panteleev 
 wrote:
 Hi,

 In the process of setting up a new development environment, I 
 noticed that DMD's codegen seems to outperform GDC's or LDC's 
 when building DMD itself.

 I wrote a test script to measure the time it takes for DMD 
 (built with different compilers) to build Phobos:

 http://dump.thecybershadow.net/9e42ff2858d1419cf41108cc50b0a83a/bench.sh

 My results are:

 dmd: 11.26
 ldc: 15.35
 gdc: 14.80
https://github.com/D-Programming-Language/dmd/blob/master/src/root/rmem.d#L166-L193 How memory is allocated makes a huge difference.
Thanks :) After changing that to version(all), LDC is faster now. Doesn't build with GDC though (multiple definitions)...
Mar 11 2016
next sibling parent reply Edwin van Leeuwen <edder tkwsping.nl> writes:
On Friday, 11 March 2016 at 14:46:59 UTC, Vladimir Panteleev 
wrote:
 Thanks :) After changing that to version(all), LDC is faster 
 now. Doesn't build with GDC though (multiple definitions)...
How much faster is LDC?
Mar 11 2016
parent Vladimir Panteleev <thecybershadow.lists gmail.com> writes:
On Friday, 11 March 2016 at 15:04:44 UTC, Edwin van Leeuwen wrote:
 On Friday, 11 March 2016 at 14:46:59 UTC, Vladimir Panteleev 
 wrote:
 Thanks :) After changing that to version(all), LDC is faster 
 now. Doesn't build with GDC though (multiple definitions)...
How much faster is LDC?
About 10%, but I didn't measure rigorously.
Mar 11 2016
prev sibling parent reply Iain Buclaw <ibuclaw gdcproject.org> writes:
On Friday, 11 March 2016 at 14:46:59 UTC, Vladimir Panteleev 
wrote:
 On Friday, 11 March 2016 at 14:32:26 UTC, Iain Buclaw wrote:
 https://github.com/D-Programming-Language/dmd/blob/master/src/root/rmem.d#L166-L193

 How memory is allocated makes a huge difference.
Thanks :) After changing that to version(all), LDC is faster now. Doesn't build with GDC though (multiple definitions)...
Yes, I know. And if I were to say which behaviour is desired. I'd say GDC is doing the right thing. Marking all functions as 'weak' is a terrible idea on both DMD's and LDC's part.
Mar 11 2016
next sibling parent Johan Engelen <j j.nl> writes:
On Friday, 11 March 2016 at 15:09:26 UTC, Iain Buclaw wrote:
 Marking all functions as 'weak' is a terrible idea on both 
 DMD's and LDC's part.
I can't judge what is best here, but LDC does not always mark functions as weak. After the DDMD switch, we have multiple def. problems on Windows when bootstrapping using LDC 0.17: https://github.com/ldc-developers/ldc/issues/1310
Mar 11 2016
prev sibling parent David Nadlinger <code klickverbot.at> writes:
On Friday, 11 March 2016 at 15:09:26 UTC, Iain Buclaw wrote:
 Yes, I know.  And if I were to say which behaviour is desired.  
 I'd say GDC is doing the right thing.

 Marking all functions as 'weak' is a terrible idea on both 
 DMD's and LDC's part.
I distinctly remember Daniel and me having to remove those functions from DDMD when we first got it to build with LDC during/after DConf 2015. LDC definitely does not mark symbols as weak/comdat/etc. by default. However, the linker might not pull in an object file from a static library if the respective symbols have already been resolved using other files. — David
Mar 11 2016