Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've found LLVM/Clang's better performance when compiling C++ code, while still offering all of the functionality I need, to be a very significant win over GCC.

With optimizations disabled, I tend to see a 30% to 40% reduction in compilation time when using LLVM/Clang instead of recent releases of GCC. That has a noticeable impact on the time it takes to develop code, especially when dealing with large systems with lots of C++ code.

So at least how I use it, I haven't really seen LLVM/Clang "catch up" in a long time. They've been delivering me better compiler performance than GCC, better diagnostic messages than GCC, suitable optimization, and very good C++11 and C++14 features, without depriving me of functionality that I find useful.



> I've found LLVM/Clang's better performance when compiling C++ code,

For C code mostly found that LLVM/Clang at compiles faster than GCC at O2 but while producing code which is considerably slower. Setting GCC to O1 usually ends up producing code which is competitive with LLVM/Clang in performance but compiles faster.

When talking about compile speed, it's easy to ignore runtime performance and let a compiler have an unfair advantage just from some difference in optimization to O level.


I'm talking about development time. I can use LLVM/Clang and develop significantly faster than I ever could using GCC. I'm not seeing there waiting as long for the C++ compiler to do its work.

If I need better optimization of binaries that I'm preparing for release, then I can always use GCC or ICC instead, for a single compilation.

That way, LLVM/Clang save me a huge amount of time on a daily basis. Then on the relatively rare occasion when I need better optimization, I'm only subjected to GCC's noticeably worse performance for a short period of time.


> I'm not seeing there waiting as long for the C++ compiler to do its work.

Then turn down optimization in GCC. The point I was trying to make is that you're likely making an apples/oranges comparison. With defaults, yes, GCC compiles slower but also produces faster binaries, you can turn the optimization level down and the results are more comparable in both dimensions. (YMMV depending on the project)


Please actually read my earlier comment: https://news.ycombinator.com/item?id=8090097

Here, let me quote it for you: "With optimizations disabled, I tend to see a 30% to 40% reduction in compilation time when using LLVM/Clang instead of recent releases of GCC."

Do you see the first part? You know, the part that goes "With optimizations disabled"? Do you see it?

I'm talking about running both LLVM/Clang and GCC with optimizations disabled. -O0. Even with optimizations disabled, GCC is still significantly slower than LLVM/Clang on all of the various C++ code bases that I have tried it with, and especially those that I work with on a daily basis.

How are we supposed to have a discussion if you aren't actually reading what was written earlier?


> Do you see it?

Apparently not. I missed it in part because it's completely at odds with my experience. Interesting, may be some codebase difference. On a codebase I work on daily -O0 gcc 4.8.2 is about 5x faster than -O0 clang (3.5-198803), 6.078 seconds vs 33.069 seconds, no cacche or anything obviously in the way.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: