Re: gtk+ speed
- From: Alberto Garcia <agarcia igalia com>
- To: gtk-devel-list gnome org
- Subject: Re: gtk+ speed
- Date: Mon, 22 Dec 2008 16:44:55 +0100
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).
However, there is a performance problem with private attributes
(if you use g_type_class_add_private()) that don't exist in other
languages, as GObject's g_type_instance_get_private() can be
noticeably slow.
There are ways of overcoming this problem, fortunately. More info
here:
http://arbur.net/serendipity/archives/40-g_type_instance_get_private-performance-costs.html
http://www.gnome.org/~federico/news-2006-01.html#24
--
Alberto García González
http://people.igalia.com/berto/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]