C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: extremely long compile time with large number of string literals
From: Mandeep Sandhu (mandeepsandhu.chd_at_[hidden])
Date: 2020-07-08 21:54:52


> On Wednesday, 8 July 2020 18:39:35 PDT Mandeep Sandhu via Std-Discussion
> wrote:
> > Can someone explain to me why it takes such a long time to compile?
> > Keeping the strings to under 5K, makes the program compile in about 8
> > secs.
>
> You should ask that question in the GCC mailing list. The standard has nothing
> to do with how long compilers take to compile anything. The standard doesn't
> care if the algorithms rerquired to implement it are quadratic or cubic or
> exponential.

I was thinking if this has something to do with generating a lot of
string objects on the stack. Just to experiment I changed the type to
store a const char* instead (I know having const char* as items of the
set is pointless) and it compiled in under a second. So it has to do
with using string objects.

>
> Suggestion: since this is clearly a generated file, instead of using
> std::unordered_set, use the gperf application or another perfect hash
> generator.

Thanks for the suggestion, I'll look into using gperf or similar.

-mandeep

>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel System Software Products
>
>
>
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups