Squeeze more performance out of the Linux kernel with Clang + LTO


Since the Linux 5.12 kernel has support for building the kernel with link-time optimizations (LTO) when using the LLVM Clang compiler, here are some benchmarks that show this performance impact as well as, more generally, how the LLVM Clang is performing. Compilers looks like if building the Linux kernel relative to GCC.

Recently, I ran Linux 5.14-rc1 benchmarks of this latest Linux kernel tree built on GCC 11 and then again on LLVM Clang 12 and most recently on LLVM Clang 12 while kernel LTO support was enabled. For this first test, tests were performed on both an AMD Ryzen 9 5950X and an Intel Core i9 11900K desktop. The same default kernel configuration was used when testing these two compilers in their release builds. The benchmarks / software in the test were retained when testing the kernel builds and not recreated or changes other than the kernel tested.

First off, let’s take a look at the performance of the Ryzen 9 5950X system …

One of the biggest winners in using Clang to compile the kernel, and especially rebuilding with link-time optimizations, was LevelDB, the key-value store written by Google and used by Chrome and many other software packages. LevelDBw consistently performs better when built with Clang rather than GCC, and even better when using link-time optimizations.

Source link


Leave A Reply