Benchmarking The Linux 5.19 Kernel Built With "-O3 -march=native"
![LINUX KERNEL](/assets/categories/linuxkernel.webp)
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.
66 Comments