GCC 4.9 Compiler Optimization Benchmarks For Faster Binaries

Written by Michael Larabel in Software on 14 April 2014. Page 3 of 5. 22 Comments

With Local Adaptive Thresholding, enabling the various optimization levels caused the performance to improve by almost 5x. When getting to -O3 -march=native, the binary's performance was 5.1x the speed of the binary without any compiler optimizations.

When moving onto another test, Himeno, there's also very marked gains. The basic optimize level (-O1) had got things started by improving the performance by 2.41x and this gain was similar with -Os and -Og. When optimizing even more (-O2), the performance was 4x faster than without any optimizations or 1.65x the speed of the basic optimization level. After -O2, there weren't any other major gains with -O3 or -Ofast. Using -march=native yielded a small performance drop and there still wasn't anything to see with LTO support.

Obviously, the more optimizations and work that needs to be done by the compiler, the longer the compilation process. With every increase to the optimization level, the longer the compilation process. The link-time optimization support (when just passing -flto without specifying a thread count) yielded the biggest increase in compile time.

Related Articles