Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Single PCH file for building the CodeBlocks_wx31_64.cbp
ollydbg:
--- Quote from: stahta01 on November 29, 2020, 07:27:39 am ---WARNING: You must include the PCH file under windows directly!
You can not just include a header that includes the PCH file and expect it to work.
Tim S.
--- End quote ---
Hi, tim, I know this, and my solution is to explicitly include this pch file in the command line, for example, when build the "src" target, it has such command line
--- Quote ---g++.exe -Wall -g -pipe -mthreads -m64 -fmessage-length=0 -fexceptions -Winvalid-pch -std=gnu++11 -DHAVE_W32API_H -D__WXMSW__ -DWXUSINGDLL -DcbDEBUG -DwxUSE_UNICODE -D_WIN64 -DCB_PRECOMP -include "sdk_precomp.h" -DEXPORT_LIB -DEXPORT_EVENTS -DWXMAKINGDLL_SCI -iquote.objs31_64\include -I.objs31_64\include -I. -IE:\code\wxWidgets-3.1.4\include -IE:\code\wxWidgets-3.1.4\lib\gcc_dll\mswu -Isdk\wxscintilla\include -Iinclude\tinyxml -Iinclude -Iinclude\scripting\include -Iinclude\scripting\sqplus -Iexchndl\win64\include -c D:\code\cb\codeblocks_sf_smalldll\src\src\main.cpp -o .objs31_64\src\main.o
--- End quote ---
You see, the "-include "sdk_precomp.h" command line option, this header file(and in-fact the .gch PCH file) will always be included in the first place.
The trick here is: you should have the SAME c preprocessor definition set when we build the sdk(the sdk_precomp.h PCH file) and the src/plugins target.
oBFusCATed:
Trick question: Do you get a build time decrease if you use a pch? How much is it? Is it worth it (for me it isn't)?
stahta01:
--- Quote from: oBFusCATed on November 29, 2020, 04:39:44 pm ---Trick question: Do you get a build time decrease if you use a pch? How much is it? Is it worth it (for me it isn't)?
--- End quote ---
I just tried adding PCH to an open source small project and I got a speed up doing all the things to speed up building except on using an PCH it actually slowed down the building. (Removing unneeded includes from headers and adding forward declares instead)
NOTE: I do have changes to Code::Blocks that speed up the building using an smaller set of includes inside the two PCH files used by CB.
But, I think that removing the use of PCH by all the contrib plugins is likely much easier than getting and maintaining the CB contrib project to build correctly using PCH.
Tim S.
ollydbg:
--- Quote from: oBFusCATed on November 29, 2020, 04:39:44 pm ---Trick question: Do you get a build time decrease if you use a pch? How much is it? Is it worth it (for me it isn't)?
--- End quote ---
I just did a test of rebuilding CodeBlocks_wx31_64.cbp. (windows 7 64bit, mingw-w64's gcc 8.1)
I have two working tree, folder A is the master(https://github.com/asmwarrior/codeblocks_sf/tree/master), folder B is the the single pch branch (https://github.com/asmwarrior/codeblocks_sf/tree/small_codeblocks_dll).
The building time is: (I first rebuild A, then rebuild B)
A: 8min 19sec
B: 4min 45sec
After those steps, I try to do rebuild A again, and the time is 8min 15 sec.
So, my conclusion is: we can save about 50% time. ;)
oBFusCATed:
No this is not how you benchmark. Apply all changes in your branch, then try to measure PCH-on versus PCH-off.
Currently you're measuring noPCH+massive amount of symbols and PCH+smaller amount of symbols. The linking step in C::B is serial, so it has big effects on the overall time. Smaller number of symbols improves linking performance.
Also what happens if you just put only wx related includes in the PCH or you use the wxprec.h or whatever is called?
p.s. My build time on Linux, GCC 9.3.0, Amd Ryzen7 1700 (relatively slow CPU in 2020, it is slower than a mobile cpu produced by a fashion/fruit company) is:
1. 93 sec with PCH.
2. 123 sec without PCH.
So, you need to buy better CPU and/or switch to better compiler. GCC on windows is massively slow. So working to switch to something like clang would be a big improvement in both speed and compiler quality (GCC on windows is pretty bad compared to how it behaves on Linux). I've not use clang on windows, but I doubt it would be as bad as GCC is. On linux clang and GCC are comparable.
And I pay 60 seconds or more every time I edit a header which is in the PCH, super annoying.
p.p.s. The compilation is really slow if the compiler emits too many errors/warnings. If you're not error/warning free you'll get horrendous build times. This is something which needs to be investigated quite a bit.
p.p.p.s. The compilation is non-optimal (and it will get worse on newer non-fruit cpus), because it cannot schedule work from multiple projects. Linking is blocking progress :(. This is clearly visible when building any plugins. Someday I'll write a ninja-build generator, but there are more important projects/problems first.
p.p.p.p.s. The switch from wx28 to wx30 made compilation visibly slower. I've not debugged why, but my guess is the use of basic_string as the base for wxString.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version