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

Reply via email to