GCC Is Currently Faster Than LLVM's Clang At Compiling The Linux Kernel
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.
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.
31 Comments