lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] Compiling takes longer with gcc-4.9.2


From: Vadim Zeitlin
Subject: Re: [lmi] Compiling takes longer with gcc-4.9.2
Date: Wed, 30 Dec 2015 02:10:48 +0100

On Tue, 22 Dec 2015 00:28:44 +0000 Greg Chicares <address@hidden> wrote:

GC> My local tree contains makefile changes to use MinGW-w64 gcc-4.9.2,
GC> with '-std=c++11', some new warning flags, and various other
GC> adjustments.

 Mine too and I guess they're pretty similar but, just for completeness,
I include below[*] the patch I used to build lmi with 4.9.2. I also had to
put "#if __cplusplus < 201103L" around the copy_if() definition in
/opt/lmi/third_party/src/cgicc/Cgicc.cpp to make it compile in C++11 mode.


GC> The bottom line:
GC>   3:19 = 199s gcc-3.4.5, std=gnu++98
GC>   7:32 = 452s gcc-4.9.2, std=c++03
GC>   9:18 = 558s gcc-4.9.2, std=c++11

 Here are my benchmarking results for comparison (times in seconds):

                      Optimization level | -O0 | -O1 | -O2 |
Compiler/C++ standard                    |     |     |     |
-----------------------------------------+-----+-----+-----+
MinGW 3.4.5 C++98                        | 101 |     | 115 |
Cygwin MinGW-w64 4.9.2 C++03             | 105 | 128 | 152 |
Cygwin MinGW-w64 4.9.2 C++11             | 150 | 175 | 186 |
Native MinGW-w64 4.9.2 C++03             |  88 | 116 | 118 |
Native MinGW-w64 4.9.2 C++11             | 126 | 146 | 158 |
-----------------------------------------+-----+-----+-----+

All builds were ran thrice and the lowest time was taken, but the
difference with the highest one one was small anyhow (1-2 seconds). I
didn't use -O1 for 3.4.5 because it didn't seem to be worth it, the
difference between -O0 and -O2 was quite small anyhow, I only tested it as
an attempt to make compiling with Cygwin 4.9.2 faster but, as you can see,
this didn't help much.

 For the reference, the command used for building with Cygwin 4.9.2 was

make PATH=/opt/lmi/bin:/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH 
PATH_GCC=i686-w64-mingw32- LDFLAGS='' gcc_common_warnings='-Wall 
-Wno-unused-local-typedefs -Wno-parentheses -Wno-unused-variable' install 
check_physical_closure

with the appropriate "optimization_flag=-ON" and "cxx_standard=-std=c++NN"
options appended to it. Notice that I had to reset LDFLAGS to avoid using
-Wl,--disable-auto-import option as the build failed with tons of linker
errors without this.

 For the native compiler I used a very similar command

make PATH=/opt/lmi/bin:/cygdrive/c/dev/mingw/4.9.2-w64-i686/mingw32/bin:$PATH 
PATH_GCC=c:/dev/mingw/4.9.2-w64-i686/mingw32/bin/ LDFLAGS='' 
gcc_common_warnings='-Wall -Wno-unused-local-typedefs -Wno-parentheses 
-Wno-unused-variable -Winvalid-pch' optimization_flag=-O2 install 
check_physical_closure -s

after installing the compiler into c:\dev\mingw\4.9.2-w64-i686 directory.


 As you can see, for me the trend is the same as for you, i.e. switching to
4.9.2 makes things somewhat slower and using C++11 makes them even worse,
but the differences are much less pronounced and the slowdown is only 1.6
in the worst case and even smaller for the native compiler which is
consistently significantly faster than the Cygwin version. The other thing
which really helps is turning off optimizations and I'd definitely advise
doing this while debugging.


GC> Vadim, can you make any sense of my timing data above,

 Not really, but I suspect that the bottleneck might be XP handling of
that many processes consuming so much RAM. Each compiler process eats up to
300MB of RAM here and I'd be surprised if XP were optimized at handling
such workloads considering the typical amounts of RAM in the PCs in 2001
when it was released. Practically speaking, I'd advise you to either switch
to a Windows 7 VM or to stop compiling under MSW entirely and cross-compile
from Linux instead. I'd expect this to give results similar to the native
MinGW builds.

GC> or think of any way to make a newer version of gcc compile lmi faster?

 Unfortunately I have to admit that the way I was thinking about, i.e.
using PCH, doesn't work. I am extremely disappointed by this and I still
don't really understand why do PCH give significant gains for wxWidgets but
not lmi, but the fact is that they clearly don't.

GC> This (4.9.2) is the latest MinGW-w64 package that Cygwin offers (they
GC> have 4.9.3 and 5.2.0 versions that target Cygwin, not MinGW). Here:
GC>   http://sourceforge.net/projects/mingw-w64/
GC> a 4.9.4-20151215 version is offered; would that native build be better
GC> for us? (I'm not really sure how their Cygwin package differs.)

 As you can see, the answer is definitely yes. As you have already taken
the trouble to set things up so that they work with both MinGW and Cygwin
paths, switching to it looks like an obvious choice. OTOH it can (will?)
probably still suffer from the same problem, whatever it is, in your VM, so
maybe cross-compiling would still be a better option.

 Regards,
VZ

[*] The patch:

---------------------------------- >8 --------------------------------------
diff --git a/install_wx.make b/install_wx.make
index 5b4cd0b..d359dc0 100644
--- a/install_wx.make
+++ b/install_wx.make
@@ -97,7 +97,7 @@ ggc_flags := --param ggc-min-expand=25 --param 
ggc-min-heapsize=32768
 config_options = \
   --prefix=$(prefix) \
   --build=i686-pc-cygwin \
-  --host=i686-pc-mingw32 \
+  --host=i686-w64-mingw32 \
   --disable-apple_ieee \
   --disable-compat24 \
   --disable-fswatcher \
@@ -118,6 +118,8 @@ config_options = \
   --without-libjpeg \
   --without-libtiff \
   --without-subdirs \
+
+unused := FIXME-VZ \
        AR='$(mingw_bin_dir)/ar' \
        AS='$(mingw_bin_dir)/as' \
        CC='$(mingw_bin_dir)/gcc $(ggc_flags)' \
diff --git a/install_wxpdfdoc.make b/install_wxpdfdoc.make
index 95f459a..c106814 100644
--- a/install_wxpdfdoc.make
+++ b/install_wxpdfdoc.make
@@ -56,9 +56,11 @@ compiler      := gcc-$(shell $(mingw_bin_dir)/gcc 
-dumpversion)
 config_options = \
   --prefix=$(prefix) \
   --build=i686-pc-cygwin \
-  --host=i686-pc-mingw32 \
+  --host=i686-w64-mingw32 \
   --disable-dependency-tracking \
   --with-wx-config=$(prefix)/bin/wx-config-portable \
+
+unused := FIXME-VZ \
        AR='$(mingw_bin_dir)/ar' \
        AS='$(mingw_bin_dir)/as' \
        CC='$(mingw_bin_dir)/gcc' \
diff --git a/workhorse.make b/workhorse.make
index aa4d62d..fe15ec8 100644
--- a/workhorse.make
+++ b/workhorse.make
@@ -141,12 +141,14 @@ gnu_cxx_version := $(shell $(GNU_CXX) -dumpversion)
 
 ifeq      (3.4.4,$(gnu_cpp_version))
 else ifeq (3.4.5,$(gnu_cpp_version))
+else ifeq (4.9.2,$(gnu_cpp_version))
 else
   $(error Untested $(GNU_CPP) version '$(gnu_cpp_version)')
 endif
 
 ifeq      (3.4.4,$(gnu_cxx_version))
 else ifeq (3.4.5,$(gnu_cxx_version))
+else ifeq (4.9.2,$(gnu_cxx_version))
 else
   $(error Untested $(GNU_CXX) version '$(gnu_cxx_version)')
 endif
---------------------------------- >8 --------------------------------------


reply via email to

[Prev in Thread] Current Thread [Next in Thread]