[Interest] Tricks to improve moc performance?
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Fri Dec 6 09:48:51 CET 2019
Il 06/12/19 09:42, Uwe Rathmann ha scritto:
> Something you can try is to include the moc file at the end of your cpp
> file. This can be done like this:
>
> #include "moc_XYZ.cpp"
>
> This type of construction is at least supported by qmake.
>
> This does not reduce the number of moc runs, but it reduces the number
> of compiler runs. As a rule of thumb for not too large classes I would
> expect, that ~50% of the compile time is spent inside the Qt headers and
> by including the moc file the overall compile time goes down by 33% as
> the headers need to be processed only once.
This trick is used in several places in Qt itself (look for "includemoc"
in commits). Not only it helps build times but also it produces slightly
better code overall.
HTH,
--
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4329 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20191206/e94a3008/attachment.bin>
More information about the Interest
mailing list