Tech media Phoronix tested and compared the performance of the GCC and LLVM Clang compilers for Apple M2 chips running on Linux.

The equipment used for this test is Apple M2 MacBook Air , running an Arch-based Asahi Linux system (which is currently the only distro that can run the latest Apple M2 chips), the test is based on the Linux 5.19 kernel, and the compiler versions are LLVM Clang 14.0.6 and GCC 12.1, both of which are Arch/Asahi The latest version of the compiler. In all tests, CFLAGS/CXXFLAGS remained unchanged for -O3 optimization level.

Dozens of different C/C++ benchmarks were run to see how, on an Apple M2 chip running Linux,Which is better for binaries produced by GCC 12 or Clang 14.

The test results are as follows: (select some results)

As you can see, while LLVM Clang is widely used by AArch64 vendors, Apple has invested heavily in upstream LLVM as part of its Xcode usage. But at least when running on (Asahi) Linux, the GCC 12 compiler still has some binaries that compile faster and perform better than Clang.

Of course, LLVM Clang is not far behind, outperforming GCC in quite a few programs.

Here’s the final result:GCC and Clang compilers have strong first-mover advantages in different areas, ifUsing the geometric mean of all test results, when tested on an Apple M2 MacBook Air running Asahi Linux,GCC 12 is almost 7% faster than Clang 14.

#Performance #comparison #GCC #LLVM #Clang #compilers #Apple #Linux

Leave a Comment

Your email address will not be published. Required fields are marked *