Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Compiling wxContribItems faster using wx/wxprec.h PCH
(1/1)
stahta01:
I was trying to speed up the building of wxSmith; but, I am failing. (2000 line patch with only 12% faster time.)
Decided to try speeding up building wxContribItems on Windows 7 32-bit using wxWidgets 2.8 branch with TDM GCC 4.7.1
It was taking about 40 Minutes to build before changes; after it takes about 8 minutes.
This is when using a Precompiled Header (PCH) "wx/wxprec.h"; anyone know of a good location to store this header in CB or wxWidgets.
In CB, I think .objs\include\wx\wxprec.h.gch is a good location; anyone have a better suggestion?
In wxWidgets I am testing this location "lib\gcc_dll\mswu\external\wx\wxprec.h.gch"
I need to decide on a good location before I can make a patch worth turning in.
Tim S.
ollydbg:
--- Quote from: stahta01 on November 05, 2013, 04:18:45 am ---I was trying to speed up the building of wxSmith; but, I am failing. (2000 line patch with only 12% faster time.)
Decided to try speeding up building wxContribItems on Windows 7 32-bit using wxWidgets 2.8 branch with TDM GCC 4.7.1
It was taking about 40 Minutes to build before changes; after it takes about 8 minutes.
--- End quote ---
Good work!
So, the bottleneck is wxContribItems, right?
--- Quote ---
This is when using a Precompiled Header (PCH) "wx/wxprec.h"; anyone know of a good location to store this header in CB or wxWidgets.
In CB, I think .objs\include\wx\wxprec.h.gch is a good location; anyone have a better suggestion?
In wxWidgets I am testing this location "lib\gcc_dll\mswu\external\wx\wxprec.h.gch"
I need to decide on a good location before I can make a patch worth turning in.
Tim S.
--- End quote ---
I think the pch file can put directly C::B's build folder, so it should be: .objs\include\wxprec.h.gch, just beside other two gches.
stahta01:
--- Quote from: ollydbg on November 05, 2013, 06:19:57 am ---
...
I think the pch file can put directly C::B's build folder, so it should be: .objs\include\wxprec.h.gch, just beside other two gches.
--- End quote ---
I think it has to be inside a folder called "wx"; because all the places using it like this
--- Code: ---#include <wx/wxprec.h>
--- End code ---
Edit: Can you be sure it will work not being inside a wx folder? Never tried it, myself.
Edit2: I will try and see if it works; I just thought is was not doable that way.
Edit3: Oops, I just realized I need to re-test because I changed Global Var cb_release_type from -g to -O2 this might be why its faster.
Edit4: Re-test still shows a great improvement. Working on patch. NOTE: I have no idea how to verify the binaries of wxContribItems are valid.
Tim S.
stahta01:
Patches to improve the compile time for wxContribItems.
NOTE: I have NOT tested the Binaries produced by wxContribItems project.
NOTE: I still need to test src/include/wxprec.h under wxWidgets 3.0. Removed the PCH building Stuff.
Adds target cleanPCH.
Adds a modified wxprec.h file needed to create the wxWidgets PCH file.
Any suggestions on another way to create the wxWidgets PCH file?
Re-did; removed the wxWidgets PCH stuff; the speedup seems NOT to be worth doing.
--- Code: ---Index: src/CodeBlocks.cbp
===================================================================
--- src/CodeBlocks.cbp (revision 9434)
+++ src/CodeBlocks.cbp (working copy)
@@ -709,6 +709,15 @@
<Mode after="always" />
</ExtraCommands>
</Target>
+ <Target title="cleanPCH">
+ <Option type="4" />
+ <Option compiler="gcc" />
+ <ExtraCommands>
+ <Add after="cmd /c if exist .objs\include\sdk_precomp.h.gch del .objs\include\sdk_precomp.h.gch" />
+ <Add after="cmd /c if exist .objs\include\sdk.h.gch del .objs\include\sdk.h.gch" />
+ <Mode after="always" />
+ </ExtraCommands>
+ </Target>
<Environment>
<Variable name="WX_CFG" value="" />
<Variable name="WX_SUFFIX" value="u" />
Index: src/CodeBlocks_wx30.cbp
===================================================================
--- src/CodeBlocks_wx30.cbp (revision 9435)
+++ src/CodeBlocks_wx30.cbp (working copy)
@@ -710,6 +710,15 @@
<Mode after="always" />
</ExtraCommands>
</Target>
+ <Target title="cleanPCH">
+ <Option type="4" />
+ <Option compiler="gcc" />
+ <ExtraCommands>
+ <Add after="cmd /c if exist .objs30\include\sdk_precomp.h.gch del .objs30\include\sdk_precomp.h.gch" />
+ <Add after="cmd /c if exist .objs30\include\sdk.h.gch del .objs30\include\sdk.h.gch" />
+ <Mode after="always" />
+ </ExtraCommands>
+ </Target>
<Environment>
<Variable name="WX_CFG" value="" />
<Variable name="WX_SUFFIX" value="u" />
--- End code ---
Modifies the wxContribItems project to use the PCH wxprec.h from prior patch.
(The PCH use Modification requires changing WXMAKINGDLL to WXUSINGDLL)
NOTE: The Binary objects are much smaller after applying this patch; it may have the side effect of reducing the symbols exported from wxWidgets headers.
NOTE: The targets KWIC and wxTreeList do NOT use the PCH header because they have no support for doing so in the code.
FYI: The KWIC has some support added at the wxCode site.
Edit: Based on more in-depth code review these targets are NOT currently safe to do the PCH use mod.
wxImagePanel
wxKwic Note: The upstream code looks link it will support changing WXMAKINGDLL to WXUSINGDLL
wxSpeedButton
wxTreeList
Re-did Patch removed the PCH search folder; still needs more testing; changing WXMAKINGDLL to WXUSINGDLL was nearly all the compile speedup.
--- Code: ---Index: src/plugins/contrib/wxContribItems/wxContribItems.cbp
===================================================================
--- src/plugins/contrib/wxContribItems/wxContribItems.cbp (revision 9436)
+++ src/plugins/contrib/wxContribItems/wxContribItems.cbp (working copy)
@@ -16,6 +16,7 @@
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWXMAKINGDLL_FNB" />
+ <Add option="-DWXUSINGDLL" />
<Add directory="wxFlatNotebook/include" />
</Compiler>
</Target>
@@ -28,6 +29,7 @@
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWXMAKINGDLL_CHART" />
+ <Add option="-DWXUSINGDLL" />
<Add directory="wxchart/include" />
</Compiler>
</Target>
@@ -40,6 +42,7 @@
<Option createStaticLib="1" />
<Compiler>
<Add option="-DWXMAKINGDLL_THINGS" />
+ <Add option="-DWXUSINGDLL" />
<Add directory="wxthings/include" />
</Compiler>
</Target>
@@ -51,6 +54,7 @@
<Option compiler="gcc" />
<Option createStaticLib="1" />
<Compiler>
+ <Add option="-DWXMAKINGDLL" />
<Add directory="wxImagePanel/include" />
</Compiler>
<Linker>
@@ -64,6 +68,9 @@
<Option type="3" />
<Option compiler="gcc" />
<Option createStaticLib="1" />
+ <Compiler>
+ <Add option="-DWXMAKINGDLL" />
+ </Compiler>
<Linker>
<Add option="-Wl,--export-all-symbols" />
</Linker>
@@ -76,6 +83,7 @@
<Option compiler="gcc" />
<Option createStaticLib="1" />
<Compiler>
+ <Add option="-DWXMAKINGDLL" />
<Add directory="KWIC/include" />
</Compiler>
<Linker>
@@ -90,6 +98,7 @@
<Option compiler="gcc" />
<Option createStaticLib="1" />
<Compiler>
+ <Add option="-DWXMAKINGDLL" />
<Add directory="wxTreeList/include" />
</Compiler>
</Target>
@@ -101,6 +110,8 @@
<Option compiler="gcc" />
<Option createStaticLib="1" />
<Compiler>
+ <Add option="-DWXMAKINGDLL_GIZMOS" />
+ <Add option="-DWXUSINGDLL" />
<Add directory="wxled/ledpanel/include" />
<Add directory="wxled/lcdWindow/include" />
<Add directory="wxled/led/include" />
@@ -127,7 +138,6 @@
<Add option="-Winvalid-pch" />
<Add option="-DHAVE_W32API_H" />
<Add option="-D__WXMSW__" />
- <Add option="-DWXMAKINGDLL" />
<Add option="-DwxUSE_UNICODE" />
<Add directory="$(#wx.include)" />
<Add directory="$(#wx.lib)/gcc_dll$(WX_CFG)/msw$(WX_SUFFIX)" />
--- End code ---
Tim S.
Navigation
[0] Message Index
Go to full version