Slow performance compared to C++, ideas?

Juan Manuel Cabo juanmanuel.cabo at gmail.com
Thu May 30 19:51:34 PDT 2013


On 05/30/2013 11:31 PM, finalpatch wrote:
> Hi Walter,
> 
> Thanks for the reply. I have already tried these flags. However, DMD's codegen is lagging behind GCC and LLVM at the
> moment, so even with these flags, the runtime is ~10x longer than the C++ version compiled with clang++ (2sec with DMD,
> 200ms with clang++ on a Core2 Mac Pro). I know this is comparing apples to oranges though, that's why I was comparing
> GDC vs G++ and LDC vs Clang++.
> 
> On Friday, 31 May 2013 at 02:19:40 UTC, Walter Bright wrote:
>> For max speed using dmd, use the flags:
>>
>>    -O -release -inline -noboundscheck
>>
>> The -inline is especially important.


Have you tried:

     dmd -profile

it compiles in trace generation, so that when you run the program you get a .log file which tells you the slowest
functions and other info.

Please not that the resulting code compiled with -profile is slower because it is instrumented.

--jm




More information about the Digitalmars-d mailing list