6 ms·
Where does CLANG vs GCC debate stand in 2017 I know CLANG is used in many research projects (which are often committed to the branch). And i assume many, many
by yazr 9y ago
Where does CLANG vs GCC debate stand in 2017
I know CLANG is used in many research projects (which are often committed to the branch).
And i assume many, many legacy projects stick with GCC.
- sprash 9y agoPeople choose CLANG mainly because of its license. But GCC still produces faster binaries.
- DominikD 9y agoNot really, this depends on the code being compiled/run, e.g.: http://www.phoronix.com/scan.php?page=article&item=gcc7-clang4-jan&num=2 http://www.phoronix.com/scan.php?page=article&item=gcc7-clan... GCC however has many more platforms supported, so in certain use cases LLVM is out of the question entirely. That being said: for OS development (and many other projects) predictable and correct is more important than fast. Optimizations that lead to these performance gains are oftentimes harmful given that code is typically far from perfect.
- floatboth 9y ago(what's with the CAPSLOCK, it's lowercase clang) Such blanket statements are not useful. Actually different compilers win on different benchmarks. Look at any test e.g. https://www.phoronix.com/scan.php?page=article&item=gcc8-clang5-znver1&num=2 https://www.phoronix.com/scan.php?page=article&item=gcc8-cla... — GCC is faster for FFTs, clang is faster for matrix factorization, … they trade blows basically.
- DSMan195276 9y agoWorth keeping in mind they didn't do this because they think `clang` is better then the current `gcc` as far as compiling goes, they did it because they don't want to use `gcc` past version 4.3.0 since versions 4.3.0 and up are GPLv3. So this is more a comparison of the current `clang` vs. old `gcc` - obviously not much of a fair comparison.
- drudru11 9y agoApple Xcode has been using clang as their 'production' compiler for years now.
- microcolonel 9y agoGCC is not for "legacy projects", it still generally generates slightly better code for general purpose programs on x86/AMD64. As Clang has been catching up to GCC in codegen quality, it has also been getting just as slow, so the old argument that Clang is faster is no longer valid. Both GCC and Clang approach their most intensive tasks in roughly the same way, and get similar performance. Clang tends to have more instrumentation tooling. GCC tends to have more interesting codegen tooling. GCC's profile-guided optimization and link-time optimization is more mature, and so is their OpenMP implementation. OpenMP code compiles better with GCC to this day. LLVM itself, on the other hand, has many benefits. It has been around longer than GCC's standalone codegen library, and the API is quite good. There are more mature GPU ISA backends in LLVM as well, though GCC supports more exotic general purpose chips and microcontrollers. This works out better right now because companies have an easier time statically linking the (more permissively licensed) LLVM libs than the GCC ones, and so investing in these backends makes more sense for GPU vendors.