LLVM Clang 12 Benchmarks At Varying Optimization Levels, LTO
Written by Michael Larabel in Software on 25 June 2021. Page 1 of 3. 18 Comments

Earlier this month were benchmarks looking at GCC 11 performance with varying optimization levels and features like link-time optimizations. Stemming from reader requests, here are now similar reference benchmarks off LLVM Clang 12.0 on the same system with going from -O0 to -Ofast and toggling -march=native and LTO usage.

With this Clang 12.0 benchmarking a number of different C/C++ benchmarks were carried out across 13 different builds consisting of:

-O2 -flto
-O2 -march=native
-O3 -flto
-O3 -march=native
-O3 -march=native -flto
-Ofast -march=native
-Ofast -march=native -flto

The same open-source C/C++ benchmarks were used as in the GCC 11 testing except where any LLVM/Clang problems were encountered in just a couple situations.

The Clang 12 compiler benchmarking was done on Fedora Workstation 34 from an Intel Core i9 11900K Rocket Lake system.

If wanting the "TLDR" version, above is the geometric mean of the 44 different benchmarks carried out. Overall they are inline with expectations. Unlike the GCC 11 tests where the "-flto" runs actually were coming in slightly slower overall, that wasn't the case with this Clang benchmarking.

Related Articles
Trending Linux News