GCC 14 vs. LLVM Clang 18 Compiler Performance On Fedora 40

Written by Michael Larabel in Software on 24 April 2024 at 11:02 AM EDT. Page 2 of 5. 34 Comments.
QuantLib benchmark with settings of Configuration: Multi-Threaded. Clang 18.1.1 was the fastest.
QuantLib benchmark with settings of Configuration: Single-Threaded. Clang 18.1.1 was the fastest.

Right out of the gate we see the competitiveness of today's LLVM Clang compiler against GCC. Going back a decade or so GCC tended to consistently lead while these days is a very nice and competitive race on x86_64 (and AArch64).

Quicksilver benchmark with settings of Input: CTS2. GCC 14.0.1 20240411 was the fastest.
Quicksilver benchmark with settings of Input: CORAL2 P1. GCC 14.0.1 20240411 was the fastest.
Quicksilver benchmark with settings of Input: CORAL2 P2. Clang 18.1.1 was the fastest.

There still are some workloads where GCC was yielding faster binaries than LLVM Clang on this AMD Zen 4 workstation.

miniBUDE benchmark with settings of Implementation: OpenMP, Input Deck: BM1. GCC 14.0.1 20240411 was the fastest.
miniBUDE benchmark with settings of Implementation: OpenMP, Input Deck: BM1. GCC 14.0.1 20240411 was the fastest.
miniBUDE benchmark with settings of Implementation: OpenMP, Input Deck: BM2. Clang 18.1.1 was the fastest.
miniBUDE benchmark with settings of Implementation: OpenMP, Input Deck: BM2. Clang 18.1.1 was the fastest.

But most commonly it was a neck-and-neck race and in some cases Clang outperforming GCC.

SMHasher benchmark with settings of Hash: wyhash. Clang 18.1.1 was the fastest.
SMHasher benchmark with settings of Hash: SHA3-256. Clang 18.1.1 was the fastest.
SMHasher benchmark with settings of Hash: Spooky32. Clang 18.1.1 was the fastest.
SMHasher benchmark with settings of Hash: fasthash32. GCC 14.0.1 20240411 was the fastest.
SMHasher benchmark with settings of Hash: FarmHash128. GCC 14.0.1 20240411 was the fastest.
SMHasher benchmark with settings of Hash: FarmHash32 x86_64 AVX. GCC 14.0.1 20240411 was the fastest.
SMHasher benchmark with settings of Hash: t1ha0_aes_avx2 x86_64. Clang 18.1.1 was the fastest.

In some of the SMHasher benchmarks (note the compiler flag differences here are set by its build system), the Clang-built binaries had nice gains over GCC while for some crypto algorithms the GCC binaries were faster.


Related Articles