Re: Usage of GTK+ headers

2005-10-13 Thread Kalle Vahlman
2005/10/12, Dan Winship [EMAIL PROTECTED]:
 Kalle Vahlman wrote:
  2005/10/12, Owen Taylor [EMAIL PROTECTED]:
  But we'd prefer that people included the main headers
  gtk/gtk.h gdk/gdk.h gdk-pixbuf/gdk-pixbuf.h, etc.

 ...

  Is there any reason to do otherwise?

 Evolution switched from using the main headers to using specific headers
 a few years ago to speed up the compile time (substantially). I think
 some other apps do this as well.

I meant things that matter.

(compile time is not a signifcant metric for software quality in my book)

--
Kalle Vahlman, [EMAIL PROTECTED]
Powered by http://movial.fi
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-13 Thread Mikael Hallendal
Kalle Vahlman wrote:
 2005/10/12, Dan Winship [EMAIL PROTECTED]:
 
Kalle Vahlman wrote:

Is there any reason to do otherwise?

Evolution switched from using the main headers to using specific headers
a few years ago to speed up the compile time (substantially). I think
some other apps do this as well.
 
 I meant things that matter.
 
 (compile time is not a signifcant metric for software quality in my book)

What do you mean?

By including only the headers you need can substantially affect the time
you spend waiting for compilation, especially in a large application
such as Evolution.

That time can of course be used to improve you application so, in a way
it can effect the quality of a code but not necessary.

So I would say that's a good reason for not doing it.

Cheers,
  Mikael Hallendal

-- 
Imendio AB, http://www.imendio.com/
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-13 Thread Mike Hearn
On Wed, 12 Oct 2005 14:55:32 -0400, Dan Winship wrote:
 Evolution switched from using the main headers to using specific headers a
 few years ago to speed up the compile time (substantially). I think some
 other apps do this as well.

These days the opposite will be true - you can precompile the GTK+ headers
all in one go and include them as a binary header. I've tried this and it
works well.

One caveat is that you can only include one binary header. But, you can
make a custom header file that simply includes gtk.h, and any other
headers a particular part of your program needs and precompile that.

The savings can be significant (on the order of 30-40% speedup in my own
tests).

thanks -mike

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-13 Thread Kalle Vahlman
2005/10/13, Mikael Hallendal [EMAIL PROTECTED]:
 Kalle Vahlman wrote:
  I meant things that matter.
 
  (compile time is not a signifcant metric for software quality in my book)

 What do you mean?

I mean I care about things visible to the user, not the developer
(alhough I *am* making stuff for the developer...).

 By including only the headers you need can substantially affect the time
 you spend waiting for compilation, especially in a large application
 such as Evolution.

Users won't be waiting for compilation to finish. They won't be
compiling (at least I hope not). Developers will, but unless you are
developing the actual software, it should be a infrequent one-time
action. And if you are developing the actual software, you will be
compiling only the modifications, which means it won't take too long
anyway so the gain is smaller.

 That time can of course be used to improve you application so, in a way
 it can effect the quality of a code but not necessary.

If indeed compiling from scratch all the time, sure, it can take a
while to compile. But I just don't think it is significant enough to
actually make a difference. I say this when developing on a mobile
Celeron @700MHz and little over 300 megs of RAM and a sluggish
harddisk, so it *MUST* be ok for other devs too ;)

If your application takes forever to compile, it could be that it's
not the compilers fault... ];-)

 So I would say that's a good reason for not doing it.

I calculate that it takes more time to figure out what header provides
this and that every time you decide to add a feature which will need a
header not included yet than to just use the toplevels and face the
compilation time penalty.

But I guess it comes down to ways of developing and other matters of
taste (which are less than useful subjects for discussion, unless
having a beer while at it).

--
Kalle Vahlman, [EMAIL PROTECTED]
Powered by http://movial.fi
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-13 Thread Tor Lillqvist
Kalle Vahlman writes:
  I calculate that it takes more time to figure out what header provides
  this and that every time you decide to add a feature which will need a
  header not included yet than to just use the toplevels and face the
  compilation time penalty.

I agree. And few developers bother removing headers that have became
unneeded after (re)moving code from a source file. Presumably, most
often developers just copy-paste the list of #includes from some other
random source file, instead of really making an effort to use just a
miminal set of headers. This certainly seems to be true in Evolution.

I know for sure that lots of Evo (including E-D-s) source files used
to include headers like sys/uio.h or pthread.h, for instance, even
if no corresponding functionality was used in the source files in
question. This doesn't really give credibility to a claim that the set
of included gtk*.h headers in Evo source files would be carefully
hand-optimized.

--tml

___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-12 Thread Tristan Van Berkom

Banginwar, Rajesh wrote:

Hello,

Many of the GTK+ libraries have one or more top level header
files. E.g. Glib has glib.h, gdk-pixbuf has two gdk-data.h and
gdk-pixbuf.h and so on... My question is about what applications
typically use? Do they use just the top level header only? Or is it ok
to use the specific header file as needed e.g. gtk/gtkstyle.h?


You should include the header indicated on the API reference,
note that if you decide to include your preffered header, a later
release may not include that header, but be compatible in every
other way, generally; there will always be a glib.h that will give
you access to the glib API.

Cheers,
-Tristan
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-12 Thread Tristan Van Berkom

Banginwar, Rajesh wrote:

Hello,

Many of the GTK+ libraries have one or more top level header
files. E.g. Glib has glib.h, gdk-pixbuf has two gdk-data.h and
gdk-pixbuf.h and so on... My question is about what applications
typically use? Do they use just the top level header only? Or is it ok
to use the specific header file as needed e.g. gtk/gtkstyle.h?


Oh yeah,
and I forgot to mention... gtk-devel-list is a list about
development on GTK+ itself, gtk-list was fine for this type of
question; no need to cross-post to this list.

Cheers,
  -Tristan
___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-12 Thread Owen Taylor
On Wed, 2005-10-12 at 10:47 -0400, Tristan Van Berkom wrote:
 Banginwar, Rajesh wrote:
  Hello,
  
  Many of the GTK+ libraries have one or more top level header
  files. E.g. Glib has glib.h, gdk-pixbuf has two gdk-data.h and
  gdk-pixbuf.h and so on... My question is about what applications
  typically use? Do they use just the top level header only? Or is it ok
  to use the specific header file as needed e.g. gtk/gtkstyle.h?
 
 Oh yeah,
  and I forgot to mention... gtk-devel-list is a list about
 development on GTK+ itself, gtk-list was fine for this type of
 question; no need to cross-post to this list.

I think the question was valid here - it wasn't a question about 

 What should I do in my app

But rather:

 What guarantees does GTK+ make that should be documented in 
  a specification of the GTK+ interface

Practically speaking, we try to maintain compatibility for GTK+
and GLib (but not libgobject) for including subheaders -- a lot
of apps include them explicitly so we have little freedom to
rearrange them. 

But we'd prefer that people included the main headers 
gtk/gtk.h gdk/gdk.h gdk-pixbuf/gdk-pixbuf.h, etc.

Regards,
Owen


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


Re: Usage of GTK+ headers

2005-10-11 Thread Matthias Clasen
On Tue, 2005-10-11 at 15:00 -0700, Banginwar, Rajesh wrote:
 Hello,
 
 Many of the GTK+ libraries have one or more top level
 header files. E.g. Glib has glib.h, gdk-pixbuf has two gdk-data.h and
 gdk-pixbuf.h and so on… My question is about what applications
 typically use? Do they use just the top level header only? Or is it ok
 to use the specific header file as needed e.g. gtk/gtkstyle.h?
 
  

The indended use is to just include the toplevel header file, ie 

#include gtk/gtk.h 

or 

#include glib.h

An exception from this rule are the stdio wrappers, for which you
explicitly have to 

#include glib/gprintf.h

This is because glib.h is not supposed to pull in stdio.h.

All of this is documented in the API docs.


Matthias


___
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list