On Tuesday, February 06, 2018 21:44:16 Ralph Doncaster via Digitalmars-d wrote: > One reason I considered porting was to > see if dmd outputs better code than gcc.
It almost certainly won't. dmd compiles code lightning fast and has a decent optimizer, but it's really not on par with gcc or llvm's optimizers at this point. For quite some time now, Walter's focus has been on D's frontend, not on the dmd backend (which is dmc), and he's the main person who would improve the backend, whereas gcc and llvm have a number of folks working on improving their optimizers. If you want comparable optimization, then you'd need to use gdc or ldc - though until gdc has another release, it's using a rather old version of the frontend, so ldc would be better; the gdc folks were seriously delayed in updating after the frontend switched to D. When using gdc or ldc, you can get binaries that compare quite favorably with C/C++ - even beat them in some case - but in general, if you compare C/C++ code compiled with gcc or clang, it will probably beat dmd compiled code - not necessarily by leaps and bounds but consistently enough that if you want your code to be as fast as possible, then you use gdc or ldc for your production builds. - Jonathan M Davis