rdmenezes / synecdoche

Automatically exported from code.google.com/p/synecdoche
GNU Lesser General Public License v3.0
0 stars 0 forks source link

GUI build should use precompiled headers #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Compiling the manager under Linux currently takes around 4 minutes. The 
main cause for this is the massive stdwx.h that includes dozens of 
wxWidgets files. stdwx.h is included in almost all .cpp files in 
clientgui. Once preprocessed, it adds 52307 lines of C++ code (this was 
measured after filtering empty lines and comments).

The solution is in two parts:
 * stdwx.h should be a precompiled header.
 * If precompiled headers aren't used (because the platform doesn't 
support them, or they were disabled, or whatever), .cpp files should 
include only the minimal set of wxWidgets headers they need.

Original issue reported on code.google.com by nicolas....@gmail.com on 18 Aug 2008 at 8:26

GoogleCodeExporter commented 9 years ago

Original comment by nicolas....@gmail.com on 29 Aug 2008 at 2:02

GoogleCodeExporter commented 9 years ago
I vote against using precompiled headers at all. They add additional complexity 
and 
the build without precompiled headers tends to get broken because of missing 
includes in a frequent manner (see the development of Code::Blocks for examle). 
The 
only gain is a slightly reduced time used for compiling.

I propose that the current includes should be changed to only include what is 
neccessary. Currently not only the bloated stdwx.h is included in most .cpp 
files 
but also a lot of other unused headers (for example all the wizard's .cpp files 
included large parts of the boinc-lib without using any of these files). This 
removes the additional complexity of precompiled headers while still keeping 
the 
compile times low.

Original comment by DerMeister667@googlemail.com on 21 Sep 2008 at 3:11

GoogleCodeExporter commented 9 years ago
That's part 2 in the issue description :)

If we include only the minimal set of needed includes, and also include stdwx.h 
only if precompiled headers are supported, the minimal set of includes will be 
ignored (due to double-include guards, which were first set in the precomp. 
header). You still get the speed given by precompiled headers, and if you don't 
use 
them, you get the speed given by minimal includes.

Currently we're in the worst speed situation: not using precompiled headers yet 
including *everything*.

Original comment by nicolas....@gmail.com on 21 Sep 2008 at 5:34

GoogleCodeExporter commented 9 years ago
Started cleaning up the includes in the manager.

Original comment by DerMeister667@googlemail.com on 24 Sep 2008 at 10:24

GoogleCodeExporter commented 9 years ago
Added myself to CC.

Original comment by DerMeister667@googlemail.com on 24 Sep 2008 at 10:27

GoogleCodeExporter commented 9 years ago
Not supporting PCH isn't an option. But we're going to do it right, and 
cleaning up 
the includes is the right place to start.

Original comment by didacty...@gmail.com on 27 Sep 2008 at 10:01

GoogleCodeExporter commented 9 years ago
With r418 the manager's includes should all be cleaned up.

Has anyone tried to get precompiled headers to work on Linux (and didn't fail)?

Original comment by DerMeister667@googlemail.com on 9 Oct 2008 at 8:29

GoogleCodeExporter commented 9 years ago
I have. It works, but I don't feel *that* much of a speed improvement with pch.

Plus I have no idea how to fit it into the build system.

Original comment by nicolas....@gmail.com on 9 Oct 2008 at 10:55

GoogleCodeExporter commented 9 years ago
That's the problem. I tried it similar to the way Code::Blocks uses precompiled 
headers. I got configure to check if the compiler supports precompiled header 
and 
added the option to build without precompiled headers. However, no matter if 
they 
should be used or not "make" decided it does not need stdwx.h.gch and therefore 
never compiled stdwx.h and therefore did not use precompiled headers.

Original comment by DerMeister667@googlemail.com on 10 Oct 2008 at 6:59

GoogleCodeExporter commented 9 years ago
I figured out how to add support for precompiled headers to the Linux build 
system 
(see r421).

The manager now compiles in about 4min 50s with precompiled headers while it 
took 
about 5min 45s without precompiled headers on my machine. Not much but better 
than 
nothing.

Original comment by DerMeister667@googlemail.com on 10 Oct 2008 at 1:43