[cfe-dev] Weird clang++ slowness
Chandler Carruth
chandlerc at google.com
Fri Oct 25 11:48:31 PDT 2013
Thanks for the analysis Oscar, please file the bug. I suspect typo
correction is the culprit here.
On Fri, Oct 25, 2013 at 11:43 AM, Óscar Fuentes <ofv at wanadoo.es> wrote:
> Hello Ben,
>
> Benjamin Kramer <benny.kra at gmail.com>
> writes:
>
> >> On 25.10.2013, at 13:13, "Óscar Fuentes" <ofv at wanadoo.es> wrote:
> >>
> >> 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:
>
>
>
> #include "boost/asio.hpp"
>
> double mainf();
>
> int mainf() {
> foo(sdafo_2, 0);
> return 0;
> }
>
>
>
> Some timings:
>
> Time (seconds) Command
> 6.8 clang -c -std=c++11 test.cpp
> 4.8 clang -c test.cpp
>
> (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'.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131025/6e2a8acf/attachment.html>
More information about the cfe-dev
mailing list