Why is this D code slower than C++?

Dave Dave_member at pathlink.com
Thu Jan 18 05:37:26 PST 2007


%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.

C++ is still being used for new development in large part because of great performance, and the 
language constructs ("expressibility") that make that possible. One area where this keeps popping up 
in D is being able to pass structs 'byref' w/o necessarily using 'inout'.


More information about the Digitalmars-d-learn mailing list