December 23, 2009
i've tested g++, gdc & dmd on an ordinary task - processing compressed data w using zlib all compilers're made from sources, target - gentoo x32 i686

c++ & d codes are simplest & alike

but, dmd makes faster result then g++
and gdc loses g++ 'cause gdc'es not have any optimization options

gdc makes slower code then dmd and does'nt support d 2.0, so it's useless

so ... i'm waiting for dmd x64

== Repost the article of Travis Boucher (boucher.travis@gmail.com) == Posted at 2009/12/23 01:51 to digitalmars.D

bearophile wrote:
> Travis Boucher:
>> Although it's design  promotes all sorta of optimization techniques, its still pretty young  (compared to gcc) and just doesn't have all of the optimization stuff  gcc has.
>
> I have already done hundred of tests and benchmarks with LDC and llvm-
gcc, and I'm starting to understand its optimizations. I am mostly ignorant of LLVM still, but I'm giving a bit of help tuning it, this improvement was motivated by me:
> http://blog.llvm.org/2009/12/advanced-topics-in-redundant-load.html
>
> Compared to GCC LLVM lacks vectorization (this can be important for certain heavy numerical computing code), profile-
guided optimization (this is usually less important, it's uncommon that it gives more than 5-25% performance improvement), but it has a link-
time optimizations that gcc lacks (about as important as profile-
guided optimization or a little more).
>
> LLVM produces bad X86 floating point code still, but its int/
FP SSE code is about as good as GCC one or better (but it's not vectorized, so far).
>
> GCC is older and it knows few extra small/
tiny optimization tricks, but in most situations they don't create a large difference in performance, they are often quite specific.
>
> So overall LLVM may sometime produce a little slower code, but in many situations it's about as good or even better (I can show a large amount of cases where LLVM is better). So the asm quality difference is smaller than you seem to imply. If the size of such performance differences are important for you, then you may want to use the Intel compiler instead of GCC, because it's sometimes better than GCC.
>
> Bye,
> bearophile


I am not trying to get into the benchmark game, for every example of gcc generating better code then llvm, there could be an example of llvm generating better code then gcc.

What I was trying to state is the overall differences between the two:

  - ldc supports newer versions of the dmd front end then gcc.   - gdc tend to generate better code then ldc (in many cases)   - gdc supports more targets (the code generator, not the runtime)

I personally use an old-ass gdc because it works for what I need.  I'd like to switch to ldc, but there is limited support for my target platform.

December 23, 2009
alkor wrote:
> i've tested g++, gdc & dmd on an ordinary task - processing compressed data w using zlib
> all compilers're made from sources, target - gentoo x32 i686
> 
> c++ & d codes are simplest & alike
> 
> but, dmd makes faster result then g++
> and gdc loses g++ 'cause gdc'es not have any optimization options
> 
> gdc makes slower code then dmd and does'nt support d 2.0, so it's useless
> 
> so ... i'm waiting for dmd x64
> 

If you can't get gdc to generate optimized code, then you are using it wrong.