C++ Logo

std-discussion

Advanced search

Re: extremely long compile time with large number of string literals

From: Mandeep Sandhu <mandeepsandhu.chd_at_[hidden]>
Date: Thu, 9 Jul 2020 17:44:37 -0700
>
> std::string can throw. For the Nth string that can throw, the compiler needs
> to generate code to destroy all the N-1 strings that were created before that
> point, then resume the exception unwinding. Experimenting with GCC shows me
> that, fortunately, the compiler generates a loop if you're using
> std::initializer_list, so this is likely not the reason you're experiencing
> long build times.

Could it be overload resolution (where the compiler has to figure out
which constructor to call) takes up much of the time?

Running with -ftime-report showed 89% of the time was spent in "phase
opt and generate". Im not sure what all compilation stages this
encompases.

-mandeep



>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel System Software Products
>
>
>

Received on 2020-07-09 19:48:03