Why is this D code slower than C++?

Bradley Smith digitalmars-com at baysmith.com
Thu Jan 18 09:57:52 PST 2007



Dave wrote:
> %u wrote:
>> Bill Baxter Wrote:
>>> So the C++ code is ok.  But it's not clear why Material became a
>>> class in the D version rather than a struct.
>> Thx. I did not notice, that "Material" is a struct in the cpp-version.
>>
>> This shows however, that programmers still are not following engeering 
>> principles: no technical documentation of the port is given and no one 
>> complains.
>>
>> Instead several people are eager searching flaws in the reference 
>> implementation of D for which there is also no technical documentation 
>> :-(
> 
> Let's assume that the OP was earnestly trying to make the C++ and D code 
> comparable... If so, then this exercise did point out some areas where D 
> needs attention. In the final analysis, it's "good faith" ports like 
> these that are going to satisfy whether or not D "is as fast or faster" 
> than C++, and in many cases, whether or not people will make the switch. 
> If it requires a lot of code modifications over and above a simple port 
> to make D comparable in performance, people will shy away from D.

Thanks for defending me, Dave. You are correct in assuming that I am 
trying to make the C++ and D code comparable. I'm not trying to sabotage 
the D effort. In fact, I would very much like to see the D code perform 
significantly better than C++. I'm just trying to learn how to write 
high-performance D code.

Thanks,
   Bradley


More information about the Digitalmars-d-learn mailing list