Null references redux + Cyclone

Walter Bright newshound1 at digitalmars.com
Mon Sep 28 19:43:36 PDT 2009


Andrei Alexandrescu wrote:
> Thanks for posting these interesting numbers. I seem to recall that 
> interface dispach in D does a linear search in the interfaces list, so 
> you may want to repeat your tests with a variable number of interfaces, 
> and a variable position of the interface being used.

No, it is done with one indirection.

interface IA { void foo(); }

interface IB : IA { }

class C : IA { void foo() { } }

void test(C c)
{
     c.foo();
}

========================================

test:
                 enter   4,0
                 mov     ECX,[EAX]
                 call    dword ptr 014h[ECX]
                 leave
                 ret



More information about the Digitalmars-d mailing list