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?
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?
Could be a bug or just macro tracking with very deep instantiations.
Impossible to say without a test case.
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?
Could be a bug or just macro tracking with very deep instantiations.
Impossible to say without a test case.
I think I hit a huge pessimization on Clang's diagnostic machinery. See
this test case:
(after replacing `sdafo_2' with `x')
1.0 clang -c test.cpp
(after replacing `sdafo_2' with `o_2')
2.8 clang -c test.cpp
Also please note how Clang quickly reports the first error about the
ilegal overload of `mainf' and then there is a long lapse of time until
it reports the error concerning `sdafo_2'.
That was my guess too. It seems that there is no method for deactivating
the feature (-fno-diagnostics-fixit-info looked promising but it made no
difference.)