Version 4.6 of GCC was released over the weekend with a multitude of improvements and version 2.9 of the Low-Level Virtual Machine is due out in early April with its share of improvements. How though do these two leading open-source compilers compare? In this article we are providing benchmarks of GCC 4.5.2, GCC 4.6.0, DragonEgg with LLVM 2.9, and Clang with LLVM 2.9 across five distinct AMD / Intel systems to see how the compiler performance compares.
For those not up to speed on the different compiler options available with GCC/LLVM, Clang is the C/Objective-C/C++ compiler front-end designed by LLVM developers for use with this unique and modern compiler infrastructure. Clang was deemed production ready as a C compiler in late 2009 with the release of LLVM 2.6. In 2010 the Clang compiler hit the milestone of being self-hosting, was enhanced by LLVM 2.7, gained support for the Boost libraries, was marked with feature-complete C++ support in LLVM 2.8, began building the Linux kernel, and was greeted by various other accomplishments.
DragonEgg is not an LLVM compiler but rather a GCC plug-in that replaces GCC's optimization and code generation paths with those from the Low-Level Virtual Machine. DragonEgg supports the plug-in functionality of GCC 4.5 and newer, but as of right now does require a minor and rather trivial patch against GCC. This LLVM-optimizations-and-code-generation-on-GCC plug-in is working with the C language along with most C++ programs. The Fortran support is improving along with ADA. There is minimal support for Objective-C and Objective-C++ and the Java support right now is broken. This plug-in also only works on x86 and x86_64 systems with Linux/Darwin/FreeBSD, where as the Clang compiler and a vanilla GCC support far more architectures and operating systems. The DragonEgg plug-in is just ideal for those still dependent upon GCC at this time but would like to take advantage of LLVM's code generators and optimizers, but is not considered production ready. The DragonEgg work supersedes LLVM-GCC, which is a LLVM C front-end to GCC. Work on LLVM-GCC is being discontinued after the LLVM 2.9 release with its developers recommending users switch to DragonEgg or Clang, so we are not benchmarking LLVM-GCC anymore.
The LLVM and Clang source-code was pulled last week from the 2.9 release SVN branch while the DragonEgg was pulled from SVN as well, but is not branched for 2.9. GCC 4.6 was using its RC2 source package. When building the Low-Level Virtual Machine, a release build was carried out (--enable-optimized and --disable-assertion arguments). GCC was built with --enable-checking=release and when building the patched GCC 4.5.2 copy for DragonEgg, --enable-lto and --enable-plugin are also required.
The five systems were based around an Intel Core 2 Duo, Intel Core i3 2100 "Sandy Bridge", Intel Core i7 990X "Gulftown", AMD Fusion E-350, and AMD Opteron 2384. No ARM systems were tested due to no available hardware for testing.
The Intel Core 2 Duo system was equipped with a dual-core E8400 CPU overclocked to 3.87GHz, Gigabyte EP45T-DS3R motherboard, 2GB of system memory, 160GB Western Digital SATA drive, and ATI Radeon HD 4850 graphics card. The new Intel Core i3 2100 is a dual-core Sandy Bridge with Hyper Threading that is operating at 3.10GHz. An Intel H67 motherboard was paired with it along with 2GB of system memory and a 60GB OCZ Vertex 2 SSD. The six-core Intel Core i7 990X CPU with Hyper Threading that's clocked at 3.47GHz was running on an ASRock X58 SuperComputer motherboard, 3GB of system memory, 320GB Seagate SATA HDD, and a NVIDIA GeForce 9800GTX graphics card.
The 1.6GHz dual-core AMD Fusion E-350 "Zacate" setup was on an ASUS E35M1-M PRO motherboard with 4GB of system memory, 60GB OCZ Vertex SSD, and using the integrated Radeon HD 6310 integrated graphics. Lastly, the AMD Opteron 2384 Quad-Core at 2.70GHz processor was on a Tyan S2927 motherboard with 4GB of system memory, OCZ Agility EX SSD, and ATI Radeon HD 4870 graphics.
Ubuntu 10.10 x86_64 was the base Linux distribution used on all five systems, but with an upgrade to the Linux 2.6.38 vanilla kernel. GCC 4.5.2 (with or without DragonEgg) could not be tested on the AMD Fusion E-350 system as GCC 4.5.x was unable to successfully build on the system due to a regression and known bug, but is resolved with GCC 4.6.0.
Testing of GCC 4.5.2, GCC 4.6.0 RC2, DragonEgg SVN plugged into GCC 4.5.2 with LLVM 2.9 SVN, and LLVM/Clang 2.9 SVN was done with a number of different Phoronix Test Suite / OpenBenchmarking.org test profiles including John The Ripper, C-Ray, Smallpt, Himeno, MAFFT, 7-Zip, FLAC, LAME MP3, GraphicsMagick, OpenSSL, x264, and timed Apache compilation. These tests are all written in C / C++.