[Gambas-devel] Multi-level virtual objects, inheritance and symbol resolution mess

Benoît Minisini gambas at ...1...
Wed Sep 10 22:57:43 CEST 2014


Le 10/09/2014 22:39, Tobias Boege a écrit :
> On Wed, 10 Sep 2014, Beno?t Minisini wrote:
>>> As each object can access its class very quickly, this would save
>>> a hashtable lookup on object creation. Not a big saving but a question that
>>> came to my mind.
>>
>> I don't see how you can save a hashtable lookup (technically it's not a
>> hashtable, but something faster) if you look for the method "_getVertex"
>> with a specific signature.
>>
>
> I meant: if I had a "tag" field in the CLASS structure for my component to
> use freely (which I haven't, for good reasons, as you said), I could store
> the structure of function pointers there after I scanned the interface and
> if I need it with any object of that class, I can retrieve it in no time:
>
> BEGIN_METHOD(Graph_getVertex, GB_STRING vert)
>
> 	GRAPH_DESC *desc = THIS->class->tag;
>
> 	/* desc->_getVertex() can be used now... */
>
> END_METHOD
>
> But I don't want to get trapped in premature optimisation here...
>

Store the pointer to the interface inside each object. Free it when the 
last object is freed.

-- 
Benoît Minisini




More information about the Devel mailing list