[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Precompiled headers
From: Simone Gotti <simone.gotti () email ! it>
Date: 2004-08-29 21:33:34
Message-ID: 200408292335.45384.simone.gotti () email ! it
[Download RAW message or body]
On Sunday 29 August 2004 19:36, Georges A.K. wrote:
> Hi everyone,
> I was wondering if there were any plans on supporting precompiled headers
> as a standard in the kde scripts ? That would speed up compiling by a lot !
> I'm still trying to find a way to compile Qt and KDE using precompiled
> headers, as I heard it decreases the compile time by a huge factor !!
>
> Georges
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> >> unsubscribe <<
Hi,
Simon Hausmann has added the feature of using pch to unsermake. Of course all
the program adapted. You can take a look at the README of unsermake.
It's implemented per target, every subdir of you project has its own
precompiled header.
Usually you can have gains of about 30-40 %.
In the implementation of a pch you have to take a look at various factors:
For example:
1) You can use only 1 pch for every compilation. So you have to create a
header that include all the others.
2) Every pch MUST have the same compilation flags used for the source, for
example a library usually is compiled with "-fPIC -DPIC" and this is
different from a bin program so they need differents PCHs.
3) If inside a source you make use of some different preprocessor defines (for
example) -DQT_NO_TRANSLATION, and the pch is created without this define, the
compiler will report an error because the pch doesn't include some functions
definitions.
4) Using the approach of unsermake you have a precompiled header for every
directory of your project and this leads to a big use of disk space (a pch
takes at least 10-20 MBytes), and every pch must be created (this takes some
seconds proportionally on the number of headers)
For this reason if you have a subproject with less than 4-5 files the time
used for the creation of the pch + the compilation can be more than the one
taken for the compilation without pch.
5) You have to make a choice of which headers to include in the pch.
For example:
If a developer (i.e. a person that change the source code) wants to speed up
the compilation time he can't add in the pch the headers inside the
subproject or every time he changes an header of the subproject all the files
are to be recompiled (because they depends on the pch).
Of course, for a user that wants to compile a program from source this is not
a problem.
I was thinking if it was possible to create a unique (or better 2, one for the
bin and one for the library) pch for every modules and not for every
subproject, for example 2 unique pchs for kdebase. This will speed up the
compilation and reduce the space needed on the harddrive. I think that the QT
do the same using an unique PCH for all the Qt subprojects.
Of course with this choices you can't add to the pch the headers of, for
example, kdebase, because if I change one of this headers, ALL the kdebase
files must be recompiled.
I'll also like that the use of PCH will help not only the users but also the
developers, because one thing that I hate (and I hope to not be the only one)
is the compilation time that I have to wait every time I change something in
my programs.
Sorry for the long post, but I have a lot of thought in these days...
Bye!
--
Simone Gotti
<simone.gotti@email.it>
KDEBluetooth framework: http://kde-bluetooth.sf.net
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic