GCC Is Currently Faster Than LLVM's Clang At Compiling The Linux Kernel

Written by Michael Larabel in GNU on 2 September 2020 at 12:00 AM EDT. 31 Comments
While LLVM's Clang C/C++ compiler was traditionally known for its faster build speeds than GCC, in recent releases of GCC the build speeds have improved and in some areas LLVM/Clang has slowed down with further optimization passes and other work added to its growing code-base. As it stands right now, GCC is faster than Clang at compiling the Linux kernel.

Presented at last week's Linux Plumbers Conference 2020 was a look at the kernel compile times with Clang. What developers Nathan Chancellor and Nathan Huckleberry found were that "GCC always beats LLVM" for 64-bit ARM and x86_64, even when LLVM is compiled with LTO and PGO enabled. Only when LLVM was compiled with PGO to build 32-bit ARM was it faster at compiling the Linux kernel than GCC.

Historically that would be surprising but given the latest compilers and their fierce but friendly rivalry over compiler performance it's not too much of a shocker. This though has led the LLVM developers to explore future avenues for improvement. For example, redundant work inline Assembly statements consume around ~13% of the build process and issues there have already been resolved for Clang 11. There are also expensive calculations tracking macro arguments source locations.

With the upstream Clang compiler building the upstream kernel compiler for x86_64 and AArch64 (and most recently i686), the LLVM developers will be looking more closely at build times moving ahead.

More details within this slide deck. Separately for those interested in evaluating different CPUs for their kernel compile time capabilities, see our OpenBenchmarking.org result overview page.
Related News
About The Author
Michael Larabel

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