Slow start times for MinGW binaries compared to VC. Advice? Topic is solved

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Si
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jul 27, 2012 11:37 am

Re: Slow start times for MinGW binaries compared to VC. Advi

Post by Si »

A fine idea :D
Si
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jul 27, 2012 11:37 am

Re: Slow start times for MinGW binaries compared to VC. Advi

Post by Si »

Am awaiting more feedback on the mailing list, after posting up some profiling reports for various builds.

In the meantime I have found that the reason we couldn't use each other's binaries was indeed down to the compiler libs, being picked up from our machines at runtime (libgcc_s_dw2-1 & libstdc++-6).

GCC 4.6.2 (from the current MinGW-get install, but not fetching the latest online packages), allows me to run PB's Minimal just fine, and cooperates with the Haskell Platform's embedded GCC 4.5.2 too. I had been running GCC 4.7.0 on this machine, which has a bunch of ABI changes.
Si
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jul 27, 2012 11:37 am

Re: Slow start times for MinGW binaries compared to VC. Advi

Post by Si »

I just noticed today that my 2.9.4 debug builds are significantly faster than my release ones. Timings until returning false within minimal's OnInit method on the Atom based machine:

Si /c/wxWidgets-2.9.4/samples/minimal$ time gcc_mswudll/minimal.exe

real 0m2.137s
user 0m0.015s
sys 0m0.062s

Si /c/wxWidgets-2.9.4/samples/minimal$ time gcc_mswuddll/minimal.exe

real 0m0.328s
user 0m0.031s
sys 0m0.031s
Si
Earned a small fee
Earned a small fee
Posts: 20
Joined: Fri Jul 27, 2012 11:37 am

Re: Slow start times for MinGW binaries compared to VC. Advi

Post by Si »

I now have a solution, for GCC >= 4.6.1.

Firstly, re-enable explicit DLL import / export, and supply a compiler flag, to bring back pre-4.5 style DLL export handling.

Flag to handle exports in pre-4.5 way:

CPPFLAGS="-fno-keep-inline-dllexport"

Ensure exports are output, by removing GCC version check in include\wx\dlimpexp.h(37), resulting in:

# elif defined(__GNUC__)
/*
__declspec could be used here too but let's use the native
__attribute__ instead for clarity.
*/
# define WXEXPORT __attribute__((dllexport))
# define WXIMPORT __attribute__((dllimport))
# endif

This keeps the build time / space requirements manageable, but makes the exports explicit instead of relying on GCC auto export / import.

Next, the executable start time and memory footprint can be brought down by using the GCC static libs:

LDFLAGS="-static-libstdc++ -static-libgcc"

This is done by default in TDM's distro for example, where he also includes a complementary shared-memory patch related to propagating exceptions out of DLLs.

Many thanks to those who helped. Very much appreciated :D

Si
Post Reply