Re: gtk+ speed



Am Mon, 22 Dec 2008 16:44:55 +0100
schrieb Alberto Garcia <agarcia igalia com>:

> On Mon, Dec 22, 2008 at 02:44:40PM +0000, Ross Burton wrote:
> 
> > > the code generated for a virtual function in C++ is as far as I
> > > understand (as I said, noob here) in principle the same as the
> > > code you have to manually write in GObject to do the same thing,
> > > it's just much more invisible.
> > 
> > Exactly.  C++ can do slightly more optimisation because the OO,
> > casting and so on are in the compiler instead of built at runtime,
> > but the underlying mechanics are the same.
> 
> As you say, because type casts are dinamic, there's the overhead of
> calling g_type_check_instance_* which in languages like C++ is not
> needed because it's done at compilation time. I suspect that this
> overhead is negligible (I haven't made real tests, though).

To be fair, you should consider that C++ has other overheads, and is
particularly hard to parse from the perspective of a compiler. And C++
is not even the only condidate for comparison, there is also
for instance Objective C, which is actually a dynamic language with
properties and messages (~signals).

In that regard the benefit of a hypothetical rewrite of Gtk in Vala
would be about avoiding human error and added type safety, rather than
making the type system faster. Much of performance problems in Glib
applications come from the way it is used, and not from GObject, which
is why I like the idea of integrating GObject with the language/ Vala.

Just my 2 pfennig,
    Christian


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