[Development] Qt Compilation Speed

Sérgio Martins sergio.martins at kdab.com
Mon Jan 3 16:10:04 CET 2022


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.

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.




Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts


More information about the Development mailing list