[Development] Qt Compilation Speed

Lars Knoll lars.knoll at qt.io
Tue Jan 4 08:52:24 CET 2022



> On 3 Jan 2022, at 16:10, Sérgio Martins <sergio.martins at kdab.com> wrote:
> 
> On 2022-01-03 13:40, Lars Knoll wrote:
>> (...)
>> One other possible solution to improve compile times is the hack we
>> used 15 years ago in KDE, where we grouped many .cpp files into one
>> compilation unit. There’s however a balance needed here, as it reduces
>> the efficiency of -j, but maybe compiling 4-8 .cpp files as one unit
>> could help.
> 
> Hello Lars,
> 
> "unity builds" were added to CMake by Christian Adam, you should read your company blog :D
> It seems to adjust the size of the amalgamations so all your CPU cores are still used.

Nice. Looks like I missed that one :)
> 
> The results are astonishing, clazy builds almost 100% faster. However, clazy does use a lot of LLVM headers, which are
> known to be slow to compile. So your mileage will vary.
> 
> It does make incremental builds slower, as then you need to recompile the entire amalgamation. For this reason I don't think
> it's a silver bullet.

It’s not. It’s a kludge. It can help you get your dependencies compiled faster, but it’s usually not very helpful for the code you’re actively working on. And as Thiago pointed out, it comes with its own share of issues.

Cheers,
Lars



More information about the Development mailing list