Re: GObject extension propose (GContainer)

On Sat, 2006-06-17 at 09:18, Tristan Van Berkom wrote:
> Alan M. Evans wrote:
> >>the lookup penalties are negligible.
> >>type node/class lookups and is_a checks are O(1);
> >>interface class lookups and conforms_to checks are O(ld(N)), where
> >>N is the number of interfaces a type node conforms to.
> >
> >Your assertion that the penalties are negligable is not really supported
> >by your response, unless the constant is also known for both orders.>  
> >
>  From my swift glance at gtype.c, it seems that in the case of
> an interface, the implementing interface is searched on that class's
> list of implementing interfaces... so when classes implement
> hundreds of interfaces it might be a performance hit.

My impression from the original question, which I didn't ask, was not so
much about access to a large number of members. If a single variable
needs to be examined many times then the performance penalty of a
generic interface lookup can add up.

In any case, I merely observed an assertion, "the lookup penalties are
negligible," and the what appeared to be supporting data, the order of
the lookups. This doesn't tell us what the penalty is, only that there
is a penalty that gets worse as the number of members increases.

Maybe the penalty is negligible, but the data presented didn't say so.
That's all I was saying.

> I dont think we've yet reached the day that we have to ditch good design
> and avoid using interfaces because of performance woes, that would
> be sorry day indeed... (I also dont think GTK+ code will be the only OO code
> needing major refactoring in those areas too... if these interface 
> lookups weren't negligable)

Indeed. I would certainly not advocate dispensing with good design. In
fact, I usually advocate the purist design in my own software, and let
Moore's Law fix the performance issues. But some cases still call for
direct access for essential performance.

I, too, would like to know the performance penalty of the generic
interface. Being lazy, I suppose I will set up some experiment to
discover it pragmatically.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]