4 ms·
Clang vs. GCC memory use graphs
- twohey 17y agoIt's nice to see competition in the compiler space. We all benefit from improved tools, and the llvm / clang folks are doing a great job making better tools. </fan> Hopefully they'll have some more announcements at WWDC
- dimitar 17y agoGenerally when you optimize for less cycles, you use more memory, and vice versa, and as far I know gcc doesn't spare memory in the name of performance. Different focus, perhaps? Anyway, what I wrote was purely anecdotal, so if anyone posts data it will be much better.
- vomjom 17y agoActually, it's often the opposite. In particular, clang tries to use the least amount of memory possible for better caching effects, which is why it compiles much faster. For the compiled program, it's also comparable in speed (and sometimes faster) in most benchmarks. That's pretty impressive given that GCC has been around much longer and has more developers.
- pohl 17y agoIt's important to know that clang is not a complete compiler. It is the C/C++ parsing front-end that can be a complete compiler with LLVM on the back end -- but clang can also be used by itself for static analysis, or integrated into an IDE for on-the-fly syntax checking. The front end of GCC, on the other hand, does not have goals of being useful in fast, interactive situations. It assumes while parsing that the end goal is program compilation. It therefore builds a larger data structure that assumes it's going all the way. So, in this case, it's not just your basic time/space tradeoff. Clang is actually doing less work. So I believe these measurements are just about parsing, and clang wins because parsing-without-compiling is a high-priority use case for clang.