Author Topic: Single PCH file for building the CodeBlocks_wx31_64.cbp  (Read 666 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12910
    • Travis build status
Re: Single PCH file for building the CodeBlocks_wx31_64.cbp
« Reply #15 on: November 30, 2020, 09:25:04 pm »
BTW: Don't get me wrong. I'm not opposing the visibility related changes. They are good and important!
I just don't like PCHs and I think they are stupid and a waste of time. :)

Do you get improvement when loading C::B? It should improve load performance, because the dynamic library loader has less work to do when loading DLLs with smaller number of symbols. At least on linux this is pretty slow step.

I don't know if the windows toolchain supports the gc-sections linker option (you need to use -fdata-sections and -ffunction-sections for the compiler for this to work). This leads to smaller .exe and .dll files when using hidden visibility at least on linux. My knowledge about windows related stuff is quite limited these days. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Single PCH file for building the CodeBlocks_wx31_64.cbp
« Reply #16 on: Yesterday at 03:33:19 pm »
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.
OK, I see. I may need to create a new branches, and cherry pick some commits to compare the PCH-on vs PCH-off issue.

Quote
Also what happens if you just put only wx related includes in the PCH or you use the wxprec.h or whatever is called?
How can I do it, I need to first build/compile the wx.h file to a gch file?
Quote
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.
You computer is strong! I'm using an old PC which I bought in 2016.

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12910
    • Travis build status
Re: Single PCH file for building the CodeBlocks_wx31_64.cbp
« Reply #17 on: Yesterday at 04:29:13 pm »
OK, I see. I may need to create a new branches, and cherry pick some commits to compare the PCH-on vs PCH-off issue.
You don't need to do this. Just build from your branch, this would give you the PCH build time. After that disable compiling of the two pch files and change CB_PRECOMP to something else in the project settings. This would give you the noPCH build time.

How can I do it, I need to first build/compile the wx.h file to a gch file?
No idea... Probably the build of wx already provides it. The other option is to remove all non-wx headers from the sdk.h and sdk_precomp.h.

You computer is strong! I'm using an old PC which I bought in 2016.
Actually it is really slow in 2020. As I've said the fruit company has a mobile processor which is faster than it. :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7016
    • My Best Post
Re: Single PCH file for building the CodeBlocks_wx31_64.cbp
« Reply #18 on: Yesterday at 06:34:34 pm »
OK, I see. I may need to create a new branches, and cherry pick some commits to compare the PCH-on vs PCH-off issue.
You don't need to do this. Just build from your branch, this would give you the PCH build time. After that disable compiling of the two pch files and change CB_PRECOMP to something else in the project settings. This would give you the noPCH build time.

How can I do it, I need to first build/compile the wx.h file to a gch file?
No idea... Probably the build of wx already provides it. The other option is to remove all non-wx headers from the sdk.h and sdk_precomp.h.

You computer is strong! I'm using an old PC which I bought in 2016.
Actually it is really slow in 2020. As I've said the fruit company has a mobile processor which is faster than it. :)

I find that changing "CB_PRECOMP" to "NOPCH" and disable compiling of PCH headers (remember to delete the PCH gch files if they exists) works okay for me.

Edit: Remember to remove the compiler "--include" command in your case.

Tim S.
« Last Edit: Yesterday at 06:44:09 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org