At 06:48 PM 9/25/2001 -0700, Paul Prescod wrote:
>Dan Sugalski wrote:
> >
> >...
> >
> > Seems like a lot of overhead for a table of function pointers. If nothing
> > else there's another level of indirection there, since the
> > variable/object/whatever header and body are separate.
>
>I don't know why they must be separate but I haven't thought about it as
>much as you have.
>
>Will Parrot have operators/functions that answer questions like: "is
>this object an instance of that class" and "what is the name of this
>object's class" and "is this class a subclass of that class"?
Yup. There's a vtable function who's sole purpose is to return the name of
the variable's type, as well as an integer representing its type. There's
also an isa and can function in there.
>Also, I don't think that in our languages the slow part of vtable lookup
>is pointer indirection. It is more often string comparisons! One extra
>pointer indirection is probably cheap.
Probably cheap, sure. The first hundred thousand times, at least. After
that it starts to add up. :)
Seriously, whenever I think "that's cheap" the next step is "how can I not
pay it in the first place". I'll be doing that pointer indirection on every
opcode that uses a variable, sometimes more than one per op. Even if all it
does is add a couple of nanoseconds and a pipeline flush, that gets pricey
reasonably quick. On the other hand, if I fake out an object at the
language level, I'll only pay the extra overhead of the magic when I
actually manipulate the underlying structures the object is hiding.
If the number of times we execute a "mess with the fake object" operation
is within even four orders of magnitude of the number of ops the engine
executes for normal code, I'll eat my hat. (And since I don't have one at
the moment, I'll be forced to go buy something reasonably silly for the
occasion :)
Dan
--------------------------------------"it's like this"-------------------
Dan Sugalski even samurai
[EMAIL PROTECTED] have teddy bears and even
teddy bears get drunk