Current C++ Compile-time Performance

I’ve started building a number of large C and C++ packages regularly again (chromium, Linux kernel, gcc and others) so I thought it would be useful to get a sense of how fast the current compilers are relative to each other.

For my testcase I chose a library from the LLVM 2.8 toolchain.  I went with 2.8 as it’s the newest version I found that would compile with GCC (g++) 3.4.  I originally hoped to find a test that would build with all versions of g++ going back to 2.7, but unfortunately the C++ language specifications and compiler strictness have changed a lot in 20 years, so that wasn’t possible.  I compared built time using debug options (-O0 -g), standard build options (-O2 -g) and optimized build options (-O3 alone).  Time was measured in seconds.

 

C++ performance

The bottom line is that the newer LLVM-based Clang compiler is considerably faster than the traditional g++ compiler, while the Intel C++ compiler and especially the Open64 compiler are quite a bit slower.  Current development versions of g++ and clang (labeled ‘trunk’) have a gap of nearly 50% for debug and standard builds.

Considering that clang/LLVM has a number of other nice features, for frequent builds it looks like switching over from gcc/g++ might be a good idea.

Comments are closed.