D 50% slower than C++. What I'm doing wrong?

ReneSac reneduani at yahoo.com.br
Mon Apr 16 18:30:29 PDT 2012


On Monday, 16 April 2012 at 22:58:08 UTC, Timon Gehr wrote:
> On 04/17/2012 12:24 AM, ReneSac wrote:
>> Windows.
>>
>
> DMC runtime !
DMC = Digital Mars Compiler? Does Mingw/GDC uses that? I think 
that both, g++ and GDC compiled binaries, use the mingw runtime, 
but I'm not sure also.

> No. They are not the same. The performance difference is 
> probably explained by the dmc runtime vs. glibc difference, 
> because your biased results are not reproducible on a linux 
> system where glibc is used for both versions.
Ok, I will benchmark on linux latter.

> This is a fallacy. Benchmarks can only compare implementations, 
> not languages. Furthermore, it is usually the case that 
> benchmarks that have surprising results don't measure what they 
> intend to measure. Your program is apparently rather I/O bound.
Yeah, I'm comparing the implementation, and I made it clear that 
it may be the GDC front-end that may be the "bottleneck".

And I don't think it is I/O bound. It is only around 10MB/s, 
whereas my HD can do ~100MB/s. Furthermore, on files more 
compressible, where the speed was higher, the difference between 
D and C++ was higher too. And if is in fact I/O bound, then D is 
MORE than 50% slower than C++.

> The difference is likely because of differences in external C 
> libraries.
Both, the D and C++ versions, use C's stdio library. What is the 
difference?



More information about the Digitalmars-d-learn mailing list