<div dir="ltr">Thanks for the analysis Oscar, please file the bug. I suspect typo correction is the culprit here.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Oct 25, 2013 at 11:43 AM, Óscar Fuentes <span dir="ltr"><<a href="mailto:ofv@wanadoo.es" target="_blank">ofv@wanadoo.es</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello Ben,<br>
<br>
Benjamin Kramer <<a href="mailto:benny.kra@gmail.com">benny.kra@gmail.com</a>><br>
writes:<br>
<div class="im"><br>
>> On 25.10.2013, at 13:13, "Óscar Fuentes" <<a href="mailto:ofv@wanadoo.es">ofv@wanadoo.es</a>> wrote:<br>
>><br>
>> I found certain source files which are taking a lot of time to compile.<br>
>> Upon investigation I measured this times:<br>
>><br>
>><br>
>> 9.8 seconds for command: clang++ -c -std=c++11 file.cpp<br>
>><br>
>> 0.2 seconds for command: clang++ -E -std=c++11 file.cpp > f.CC<br>
>> (creates a 2.9 MB file)<br>
>><br>
>> 3.4 seconds for command: clang++ -c -std=c++11 f.CC<br>
>><br>
>><br>
>> So explicitly preprocessing and then compiling takes less than half the<br>
>> time of compiling the original file.<br>
>><br>
>> I guess this is due to macro expansion tracking for diagnostic purposes.<br>
>> The C++ file contains some errors (it belongs to a test suite) although<br>
>> I see no references to macros on the output of the compiler.<br>
>><br>
>> So how can I speed up the compilation? Can this be considered a bug?<br>
><br>
> Could be a bug or just macro tracking with very deep instantiations.<br>
> Impossible to say without a test case.<br>
<br>
</div>I think I hit a huge pessimization on Clang's diagnostic machinery. See<br>
this test case:<br>
<br>
<br>
<br>
#include "boost/asio.hpp"<br>
<br>
double mainf();<br>
<br>
int mainf() {<br>
foo(sdafo_2, 0);<br>
return 0;<br>
}<br>
<br>
<br>
<br>
Some timings:<br>
<br>
Time (seconds) Command<br>
6.8 clang -c -std=c++11 test.cpp<br>
4.8 clang -c test.cpp<br>
<br>
(after replacing `sdafo_2' with `x')<br>
1.0 clang -c test.cpp<br>
<br>
(after replacing `sdafo_2' with `o_2')<br>
2.8 clang -c test.cpp<br>
<br>
<br>
<br>
Also please note how Clang quickly reports the first error about the<br>
ilegal overload of `mainf' and then there is a long lapse of time until<br>
it reports the error concerning `sdafo_2'.<br>
<div class="HOEnZb"><div class="h5"><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>