6 ms·
Pros: Faster compile times. Better error messages. BSD license.(More in line with their project not a judgement on my part.) Designed to make use in tools e
by stonemetal 14y ago
Pros:
Faster compile times.
Better error messages.
BSD license.(More in line with their project not a judgement on my part.)
Designed to make use in tools easier.
Cons:
Code produced isn't as fast, but not much slower.
- drivebyacct2 14y agoI thought Firefox was seeing speedups from using Clang generated code? I guess I don't know the average case of course, but I'm curious to hear more about this, my Clang/LLVM-fu is weak
- sounds 14y agoOne area where Clang really shines is compile time - it's faster than gcc, at least a little [1]. The claims about who has faster binaries are pretty difficult to judge - it seems they really are about equal. It may be highly superscalar CPUs with instruction reordering and register aliasing hide the difference. [1] http://gcc.gnu.org/ml/gcc/2012-02/msg00134.html http://gcc.gnu.org/ml/gcc/2012-02/msg00134.html (probably unbiased) and http://clang.llvm.org/performance.html http://clang.llvm.org/performance.html (probably biased)
- repsilat 14y agoIt depends a lot on the use-case. For my hobby project (numerical stuff, C++) I got a speedup of more than 10% by moving to Clang. Huge stuff. I spend ~50% of my time in one hot function, though, and it's entirely possible that GCC generated better code for the rest of the project. As usual, the only reliable way to know which compiler generates better code for your program is to run benchmarks. For what it's worth, I wasn't blown away by the compile times or error messages when I moved to Clang. I think GCC is getting a lot better, but I'd also learned to live with its failings regardless.
- gillianseed 14y agoFor me it's mainly the error messages, either Clang/LLVM has gotten slower in compiling or GCC has gotten faster, but it's not a big 'percieved' difference for me anymore. I think the Clang error messages are more informative and also that the colored output makes it easier to read. Performance-wise though I still generally get ~5-15% better speed on generated code with GCC (corei7).
- Lednakashim 14y agoMy code consists of tight loops used for numerical simulation. Clang runs about 2x slower. Hence I conclude that Clang is bad for optimizing tight loops. Many of the Clang vs. GCC tests are clandestinely skewed towards llvm because they involve code that does not benefit from low level optimization. Many of the people who work on GCC are scientists who want tight loop performance while many of the folks who work on clang want a BSD license.
- gillianseed 14y agoWell you are likely thinking of Raphael Espindola's tests of using Clang to build Firefox, and those tests showed that Clang/LLVM was better in some instances but overall GCC was faster. HOWEVER the GCC he tested against was GCC 4.2, a ~5 year old version of GCC which is the version OSX ships with (he was using OSX) so the tests as comparative between GCC and Clang/LLVM of today were pointless. It should also be noted that Firefox as used on people's machines today gets a large performance boost from profile-guided-optimization (remember back when people noticed that win32 Firefox under wine was faster than native Firefox on Linux? This was because of the Linux versions not being compiled with profile-guided-optimization at the time), and this optimization is not available for Clang/LLVM (though iirc there's a GSOC project for it this summer).