GCC 11 Compiler Performance Benchmarks With Various Optimization Levels, LTO
Given the recent forum discussion stemming from the -O3 optimization level still too unsafe for the Linux kernel (in part due to older, buggy compilers) and some users wondering about the current -O2 versus -O3 compiler optimization level impact, here is a fresh round of reference benchmarks using GCC 11.1 on Fedora Workstation 33 looking at various optimization levels and optimizations tested on dozens of different application benchmarks to see the overall impact on performance.
With the recent optimization level discussions and not having done any thorough optimization level comparison tests and link-time optimization (LTO) testing of the recently released GCC 11, here is this Monday article for those interested in compiler optimizations.
The combination of CFLAGS/CXXFLAGS tested included:
-O3 -march=native -flto
Those dozen different CFLAGS/CXXFLAGS combinations were tested across 43 benchmarks looking at the performance on the resulting code each time.
This round of testing was carried out using an Intel Core i9 11900K "Rocket Lake" system with Fedora Workstation 33.