Overhead of type casting when using GObject system


I am looking for information about the type system used in GType and
GObject. Im am interested to know, how much overhead is created by the
type casting macros.

AFAIK types in GTK can be dynamic as well as static [1]. I am assuming
that most types in GTK are static types. But still if I am not mistaken,
then the casting of one typ into another one is done dynamically at
runtime which creates a certain overhead.

In contrast in C++ or Java the type system can statically verify that in
a variable assignment or function parameter passing the variable is a
subtype of the assigned type and thus there is no actual casting
necessary at run time.

So if in C if write this:
GtkGrid* grid = gtk_grid_new();
GtkWidget* widget = GTK_WIDGET(grid);

then this creates more overhead then when in Java I write this:
JTabel tabel = new JTabel();
Object object = tabel; // No cast required.

Is this observation correct, and if so, then how much overhead does this
casting create in comparison to C++ or Java. Are there any metrics


[2] http://developer.gnome.org/gtk-tutorial/2.24/c450.html#SEC-CASTING

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