Optimize my code =)

bearophile bearophileHUGS at lycos.com
Thu Feb 20 13:44:13 PST 2014


Robin:

> All in all I must say that I am more pleased with the DMD 
> results as I am kind of worried about the LDC allocation test 
> performance ...

I am not sure of the causes of this, but the D GG was improved a 
little, in the last two compiler versions.


> I also had to rewrite parts of the codes as some functions just 
> weren't "pure" or "nothrow" such as the whole things around 
> this.data[] += other.data[].

This because LDC2 is one version of the language behind. It's a 
temporary problem.

Your multiplicationTest timings with LDC2 seem to have not yet 
reached the performance of your C++ code. You can take a look at 
the asm output of both. Perhaps in the D code you have some 
allocation you are not doing in the C++ code.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list