drawkcaB | Backward Compatible logo

rants and tips about software

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.

Milan Babuškov, 2008-02-16
Copyright © Milan Babu┼íkov 2006-2024