D 50% slower than C++. What I'm doing wrong?
Timon Gehr
timon.gehr at gmx.ch
Mon Apr 16 15:58:07 PDT 2012
On 04/17/2012 12:24 AM, ReneSac wrote:
> On Monday, 16 April 2012 at 07:28:25 UTC, Andrea Fontana wrote:
>> Are you on linux/windows/mac?
>
> Windows.
>
DMC runtime !
> My main question is now *WHY* D is slower than C++ in this program? The
> code is identical (even the same C functions)
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.
> in the
> performance-critical parts, I'm using the "same" compiler backend
> (gdc/g++), and D was supposed to a fast compilable language.
/was/is/s
> Yet it is up to 50% slower.
>
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.
> What is D doing more than C++ in this program, that accounts for the
> lost CPU cycles?
> Or what prevents the D program to be optimized to the
> C++ level? The D front-end?
The difference is likely because of differences in external C libraries.
More information about the Digitalmars-d-learn
mailing list