3 ms·
It'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 -- bu
by pohl 17y ago
It'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.