Woeful performance of D compared to C++

Walter Bright newshound at digitalmars.com
Thu Jan 18 21:31:17 PST 2007


Sean Kelly wrote:
> Bill Lear wrote:
>>
>> The rand() call is definitely the most expensive.  When I remove it
>> from both the C++ and the D program, the times plummet (to 0.003
>> and 0.013 seconds, respectively --- still, however, leaving the D
>> program running in 4.3 times that of the C++ program;-).
> 
> With execution times that short, you're really comparing the startup 
> time of a D application vs. a C++ application.  And D application 
> startup time includes the initialization of a garbage collector, in the 
> default case.  If you really wanted to compare apples to apples here I'd 
> rip out the default GC and replace it with one that has no 
> initialization cost.

There are easier solutions to get better timings. See:

http://www.digitalmars.com/techtips/timing_code.html



More information about the Digitalmars-d mailing list