[cfe-dev] Weird clang++ slowness

Óscar Fuentes ofv at wanadoo.es
Fri Oct 25 04:11:22 PDT 2013


I found certain source files which are taking a lot of time to compile.
Upon investigation I measured this times:


9.8 seconds for command: clang++ -c -std=c++11 file.cpp

0.2 seconds for command: clang++ -E -std=c++11 file.cpp > f.CC
    (creates a 2.9 MB file)

3.4 seconds for command: clang++ -c -std=c++11 f.CC


So explicitly preprocessing and then compiling takes less than half the
time of compiling the original file.

I guess this is due to macro expansion tracking for diagnostic purposes.
The C++ file contains some errors (it belongs to a test suite) although
I see no references to macros on the output of the compiler.

So how can I speed up the compilation? Can this be considered a bug?




More information about the cfe-dev mailing list