Basically I want to make a dynamic typing subsystem in D. I want to
take a given object of a static type, construct a dynamic interface
for it and later use that interface to event handling.
To construct a dynamic interface, I need to extract the virtual
methods without resolving them prematurely.

On Fri, May 4, 2012 at 1:11 AM, Steven Schveighoffer
<schvei...@yahoo.com> wrote:
> On Thu, 03 May 2012 16:57:01 -0400, deadalnix <deadal...@gmail.com> wrote:
>
>> Le 03/05/2012 22:22, Gor Gyolchanyan a écrit :
>>>
>>> That workaround is pretty obvious, but I can't afford to make an extra
>>> call every time. This event system is supposed to be ultra-fast. Isn't
>>> there a way to get to the vtable etry itself?
>>
>>
>> 1/ Such a trivial thing is surely inlined by any compiler with
>> optimizations on.
>
>
> I wouldn't count on it.  You can't inline a lambda that is used somewhere
> it's not declared.
>
>
>> 2/ You can afford a virtual dispatch, but can't afford a function call ?
>
>
> In my experience, virtual calls are nearly as cheap as normal calls.  But
> doubling the function call setup/teardown/call is not insignificant.  It all
> depends on how much time is spent in the function being called.
>
>
>> I do think you are in case of premature optimizations here.
>
>
> This is very likely, it all depends on what you are doing *inside* the call.
>
> -Steve



-- 
Bye,
Gor Gyolchanyan.

Reply via email to