GCC isn't that slow after all
I wrote about GCC C++ compiler (g++) before and was really unhappy how slow it is compared to commercial compilers (MS Visual C++ and Borland's C++).
Today I tried building FlameRobin with MSVC Express. It works really nice and it builds FR from scratch in about 2.5 minutes on this machine where I tried it (Intel Celeron M 1.4GHz with 256MB RAM). This in on Windows XP Pro with all anti-virus and similar software turned off.
Then I tried on Linux (it's a dual boot machine) and GCC took 272 seconds, i.e. 4.5 minutes. Both compilers are using PCH. I got really frustrated about this in the past, so much that I considered to install Windows on my machine and do FR development there.
But, I suddenly got the idea that GCC might be losing too much time optimizing. So, I tried to lover the optimization from level 2 to level 1. I got slight improvement: 225 seconds. Still too slow. Then I turned it off, and I got the amazing 130 seconds, i.e. 2:10. This is quite acceptable to development and I guess I'll only use -O2 when we build the release versions from now on.
The option can be changed by setting CXXFLAGS environment variable before you run 'configure' script. Something like this (if your shell is bash):
$ export CXXFLAGS=
$ ../configure ...
$ make
It looks like GCC C++ compiler isn't that bad after all. I won't be switching to Windows any time soon.
3 Comments:
What about other FLAGS? Do you use "-pipe", for e.g.?
No, nothing. FLAGS is not even set.
Here's a typical g++ line that shows up when I run make:
/home/milanb/devel/flamerobin/rel286noopch/bk-deps g++ -c -o flamerobin_urihandler.o -I.pch/flamerobin -DHAVE_FRCONFIG_H -DIBPP_LINUX -I. -I../src -I../src/ibpp -I../res -I/opt/wx286-release-unicode-shared-dynamic/lib/wx/include/gtk2-unicode-release-2.8 -I/opt/wx286-release-unicode-shared-dynamic/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -DWX_PRECOMP ../src/urihandler.cpp
Well, "-pipe" is well-known time-saver.
Post a Comment
<< Home