Benchmarking The Linux 5.19 Kernel Built With "-O3 -march=native"

Written by Michael Larabel in Linux Kernel on 13 July 2022 at 06:30 AM EDT. 66 Comments
LINUX KERNEL --
Following the upstream discussions over -O3'ing the Linux kernel last month I ran some fresh benchmarks of the Linux kernel built with -O2 versus -O3. After the -O3 optimized kernel build results weren't too impressive, a number of Phoronix readers were virtually shouting that "-O3 -march=native" is where it's at for fun and performance... To appease those even though in the past it hasn't proven worthwhile and upstream kernel developers are against it, here are those numbers.

Building off last month's -O2 versus -O3 kernel build comparison, after that I ran a Linux kernel build with "-O3 -march=native" to cater towards the Alder Lake processor being used for this testing rather than generic x86_64. No other changes were made to the system besides rebuilding the same Linux kernel and same Kconfig otherwise with the different KCFLAGS.

But long story short, the "-O3 -march=native" kernel build didn't yield significantly better performance -- in fact, when built with GCC 11 on Ubuntu 22.04 LTS, it regressed in a number of workloads.


The "-O3 -march=native" kernel performance in particular for some I/O workloads was yielding results that were not only slower than the -O3 kernel built also -O2.





From database workloads to basic I/O benchmarks with FIO, it was common to see the "-O3 -march=native" kernel yield results significantly behind the less aggressively optimized kernels.















Aside from that the results were basically a wash... The "-O3 -march=native" optimized kernel wasn't paying off in the dozens of benchmarks tried on this Core i5 12600K desktop. Those wishing to dig through the dozens of mostly flat results can see this result page for all the data in full.

On a geometric mean of the dozens of benchmarks carried out, the "-O3 -march=native" kernel in fact came out slightly slower due to the regressions in the I/O benchmarks. So at least in the case of this particular Intel Alder Lake system, the "-O3 -march=native" kernel optimized build wasn't worthwhile.
Related News
About The Author
Author picture

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week