Inherent code performance advantages of D over C?

Maxim Fomin maxim at maxim-fomin.ru
Fri Dec 6 23:38:06 PST 2013


On Friday, 6 December 2013 at 23:30:45 UTC, Walter Bright wrote:
> On 12/6/2013 3:06 PM, Maxim Fomin wrote:
>> and what about holes in immutable, pure and rest type system?
>
> If there are bugs in the type system, then that optimization 
> breaks.

Bad news: there are many bugs in type system.

>
>> C doesn't have virtual functions.
>
> Right, but you can (and people do) fake virtual functions with 
> tables of function pointers. No, C doesn't devirtualize those.
>

Neither does D.

>> By the way, does D devirtualize them?
>
> It does for classes/methods marked 'final'

this is essentially telling nothing, because these functions are 
not virtual. In your speaking, C 'devirtualizes' all direct 
calling.

> and also in cases where it can statically tell that a class 
> instance is the most derived type.

I haven't noticed that.


More information about the Digitalmars-d mailing list