D code optimization

H. S. Teoh via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Sep 22 09:33:36 PDT 2016


On Thu, Sep 22, 2016 at 04:09:49PM +0000, Sandu via Digitalmars-d-learn wrote:
> It is often being claimed that D is at least as fast as C++.
> Now, I am fairly new to D. But, here is an example where I want to see
> how can this be made possible.
> 
> So far my C++ code compiles in ~850 ms.
> While my D code runs in about 2.1 seconds.
[...]

Which compiler are you using?

If you're looking for performance, you should use gdc or ldc, as they
have better optimizers. While dmd is the most up-to-date in terms of
language implementation, I've found that the code it generates
consistently performs about 20-30% slower than code generated by gdc
(sometimes even more, depending on what the program does).


T

-- 
Век живи - век учись. А дураком помрёшь.


More information about the Digitalmars-d-learn mailing list