I know people love to compare compilers… But for instance, let’s take GCC and Clang.
GCC supports far more languages such as Go and Java, but Clang is much faster and consumes less memory. So, here we have a conundrum because for 1. there’s no way in hell you’re compiling Go with Clang and 2. you can’t dock points from GCC for being slower as it is built to the standards of several languages without AST support.
Comparing compilers for this reason is almost useless.
What you can compare however are optimizations.
For instance, a kernel compiled with Clang will almost without a doubt always be faster than one compiled by GCC due to how Clang issues optimizations.
At the same time, one compiler may be better suited for one driver than another thus causing slow downs if optimizations are discarded.
It’s Pandora’s Box. It’s not definitive. I can say X is better than Y for usecase Z, but I can’t say X is always better than Y.
Is this a joke? GCC is typically higher performance and offers wider support for obscure architectures (by nature of having been around a long time). Clang is favorable for its permissive license and modular architecture enabling wide reusability of its components for things like clang-format and easy development of new languages (such as Rust) while being able to share optimizations at various levels.
Comparative to the compilation of Linux? Yes. I am very serious. Torvalds called out the faults with Clang and its license awhile ago meanwhile Google is shifting over to Clang in their builds due to the added performance benefits. Yes, GCC supports more architectures. I had never said that it didn’t. I did say however that due to it’s ability to act as a library it has the added flexibility of supporting (at least in the case of ARM, from first hand experience) notably more levels of optimizations in a cleaner way.
We (CarbonROM) actually run tests annually with new revisions of GCC and Clang to determine what will provide the best performance overall. Again, we do this with embedded devices so results differ.
I will not lie. In benchmarks on x86 Clang and GCC 8 trade blows, but for chipsets such as the Cortex-A53 and so on, there is enough of a negligible performance difference that does make Clang a more viable solution for inline compilation.