Re: GObject extension propose (GContainer)

On Fri, 16 Jun 2006, Gustavo J. A. M. Carneiro wrote:

Qui, 2006-06-15 às 13:00 -0400, Tristan Van Berkom escreveu:

All of that just to say... I cannot count the times I've thought to
myself that
GtkContainer should really just be GContainerIface, and implemented by
whatever interested objects that want to parent other objects...

 That's interesting, but I wonder what is the runtime penalty of
interface lookup compared to normal class structure lookup?  Is it
really OK to use an interface for this, or is it better just to add a
new virtual methods to the GObject class?

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.

Gustavo J. A. M. Carneiro


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