On Tuesday, 25 January 2022 at 19:52:17 UTC, Ali Çehreli wrote:
I am not experienced with dub but I used
--build=release-nobounds and verified that -O3 is used for both
compilers. (I also tried building manually with GNU 'make' with
e.g. -O5 and the results were similar.)
`-O5` does not do anything different than `-O3` for LDC.
For a test run for 2 million numbers:
ldc: ~0.95 seconds
gdc: ~0.79 seconds
dmd: ~1.77 seconds
I am using compilers installed by Manjaro Linux's package
system:
ldc: LDC - the LLVM D compiler (1.28.0):
based on DMD v2.098.0 and LLVM 13.0.0
gdc: dc (GCC) 11.1.0
dmd: DMD64 D Compiler v2.098.1
I've been mainly a dmd person for various reasons and was under
the impression that ldc was the clear winner among the three.
What is your experience? Does gdc compile faster programs in
general? Would ldc win if I took advantage of e.g. link-time
optimizations?
Tough to say. Of course DMD is not a serious contender, but I
believe the difference between GDC and LDC is very small and
really in the details, i.e. you'll have to look at assembly to
find out the delta.
Have you tried `--enable-cross-module-inlining` with LDC?
-Johan