1 Matching Annotations
  1. Jan 2023
    1. While Clang has historically been faster than GCC at compiling, the output quality has lagged behind. As of 2014, performance of Clang-compiled programs lagged behind performance of the GCC-compiled program, sometimes by large factors (up to 5.5x),[28] replicating earlier reports of slower performance.[26] Both compilers have evolved to increase their performance since then, with the gap narrowing: Comparisons in November 2016 between GCC 4.8.2 versus clang 3.4, on a large harness of test files shows that GCC outperforms clang by approximately 17% on well-optimized source code. Test results are code-specific, and unoptimized C source code can reverse such differences. The two compilers thus seem broadly comparable.[30][unreliable source] Comparisons in 2019 on Intel Ice Lake has shown that programs generated by Clang 10 has achieved 96% of the performance of GCC 10 over 41 different benchmarks (while winning 22 and losing 19 out of them).[29]

      Clang is faster than GCC because it uses LLVM as its underlying compiler infrastructure. LLVM has a highly optimised code generation approach that makes it very efficient in terms of both space and time. In addition, Clang also contains several optimisation passes (such as global optimisations and link-time optimisation) that improve the generated code further.