Old problem with performance

Weed resume755 at mail.ru
Mon Feb 9 02:07:10 PST 2009


Kagamin пишет:
> Weed Wrote:
> 
>> The code on C++ is also approximately in 6 times faster a code with
>> classes on D. (I do not give an example on C++ because classes on C++
>> work just as structures in D.)
> 
>> class C {
>>     int i;
>>     real[5] unused; // to prevent returning this object in registers
>>
>>     C opAdd( C src ) {
>>         auto ret = new C;
>>         ret.i = i + src.i;
>>         return ret;
>>     }
>> }
> 
> Well, D class code here is not equivalent to C++ class code. D code has more features, namely, it's polymorphic: C.opAdd is able to work with classes, derived from C, while corresponding C++ code is unable to do so.

It is really true?



More information about the Digitalmars-d mailing list