Simon Cozens <[EMAIL PROTECTED]> writes:
>I'm obviously missing something about vtables. It'll be obvious when someone
>corrects me, but...
>
>Currently, SvPVX(foo) requires one lookup; with a vtable, it would necessitate
>two, (One to find the functino in "foo", and then the functino must find the
>data in "foo") given that C, beastly as it is, doesn't let us create anonymous
>function pointers. And given that the functinos are dynamic, this isn't
>something that can be optimized. Oops! In fact, it may require three lookups,
>because we're doing something like this:
>
>    sv->vtable->svpvx;

As opposed to 

     *( sv->sv_any + offset )

>
>Isn't this going to really, really hurt?

A. We don't know till we try.

B. SvPVX is the inner-inner most accessor - vtables make more sense at the 
   SvPV level that XS code normally uses. When you factor out the type
   checking and flag tests in SvPV the vtable may actually be cheaper.



-- 
Nick Ing-Simmons

Reply via email to