Optimizing the unoptimizable: a journey to faster C++ compile times
1–10 of 32 posts
Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#2Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#3[flagged]
Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#4[flagged]
Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#5Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#6Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#7The real solution to fast compilation is to have modules. These kind of one-off hacks are interesting but will not scale.
Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#8So why on earth is std::string so slow to compile, if it's possible to compile this full-featured formatting library in 1/4 of the time?
Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#9The real solution to fast compilation is to have modules. These kind of one-off hacks are interesting but will not scale.
I don't agree. The real solution for fast compilation times is to not have to recompile things. This means onboarding tools like ccache, organize your project around independent subprojects which eliminate/minimize compile-time dependencies, and leverage incremental builds.
There's a C++ book somewhere that describes how the subprojects approach helps lower build times to a residual length which if my memory doesn't fail me was dubbed horizontal architecture. It consists of designing every single subprojects to be stand-alone and leave any integration to the linking stage. I've used it in the past on a legacy C++ project that took slightly over 1h to pull off an end-to-end build, and peeling out 4 or 5 subprojects following the horizontal architecture approach allowed me to cut down full end-to-end build times to slightly over 8 minutes and incremental builds down to less than a minute, without bothering with compiler caches. I'm sure that if I bothered onboarding ccache I could drive incremental build times to just a few seconds.
If you know what you are doing, you can do a lot without begging for magic.
Re: Optimizing the unoptimizable: a journey to faster C++ compile times
#10So why on earth is std::string so slow to compile, if it's possible to compile this full-featured formatting library in 1/4 of the time?
EDIT:
This compiles in 1 second on an i7 laptop.
import std;
int main()
{
std::cout