GCC 4.9 Compiler Optimization Benchmarks For Faster Binaries

Written by Michael Larabel in Software on 14 April 2014 at 11:16 AM EDT. Page 1 of 5. 22 Comments.

For those curious about the impact of modern compiler tuning CFLAGS/CXXFLAGS when using the GCC 4.9 compiler with an Intel Core i7 "Haswell" processor, here are many benchmarks of many C/C++ code-bases when testing a variety of compiler optimization levels and other flags.

For mostly reference purposes, this week I did a number of GCC 4.9 RC1 benchmarks on an Intel Core i7 4770K system running Ubuntu 14.04 LTS. The GCC optimization settings tested were:

-O0
-O1
-O2
-Os
-Og
-O3
-Ofast
-O3 -march=native
-O3 -march=native -flto

For those unfamiliar with these compiler controls, see GCC's optimize options documentation. Covered are all the basic optimization levels, targeting code generation for the Core i7 CPU, and also trying out link-time optimizations. I also tried using -fno-fat-lto-objects and -fuse-linker-plugin but those options caused the builds to fail.

A variety of C and C++ open-source benchmarks were run via the Phoronix Test Suite for this compiler benchmarking. The primary focus is on testing the performance of the generated binaries under each configuration but there's also a few timed compilation tests included.


Related Articles