How to tune numerical D? (matrix multiplication is faster in g++ vs gdc)

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Mar 3 20:49:20 PST 2013


On 3/3/13 10:48 PM, J wrote:
> Dear D pros,
>
> As a fan of D, I was hoping to be able to get similar results as this
> fellow on stack overflow, by noting his tuning steps;
> http://stackoverflow.com/questions/5142366/how-fast-is-d-compared-to-c
>
> Sadly however, when I pull out a simple matrix multiplication benchmark
> from the old language shootout (back when it had D), it is disturbingly
> slower in D when pit against C++.

You're measuring the speed of a couple of tight loops. The smallest 
differences in codegen between them will be on the radar. Use straight 
for loops or "foreach (i; 0 .. limit)" for those loops, the foreach 
forms you currently may introduce slight differences in codegen.

Andrei




More information about the Digitalmars-d mailing list