[Interest] Tricks to improve moc performance?

Hamish Moffatt hamish at risingsoftware.com
Mon Dec 9 23:51:24 CET 2019


On 10/12/19 9:14 am, Adam Light wrote:
>
>
> When I previously analyzed the sampling data during a moc.exe run, it 
> was clear that the vast majority of the time was spent satisfying the 
> includes, and most of that was checking whether a concatenation of an 
> include path and a file name are a valid file (eg. 
> include/path1/stdio, include/path2/stdio, etc.). It seems like the 
> compiler (cl.exe) would need to do essentially the same thing when 
> compiling each individual file, but it's not nearly as slow as moc.


If my memory serves me correctly, we found MOC drastically slower when 
we upgraded from Qt 4.8 to 5.x. We had quite a few directories in 
INCLUDEPATH, though nothing like the number you mentioned.

To get acceptable performance we trimmed INCLUDEPATH to a higher level 
directory and started referencing <module/file.h> instead of just <file.h>.


At development time we build in Visual Studio using the vcxproj 
generator in qmake, which won't run multiple MOC steps in paralle. If 
you think your MOC time is bad, imagine running them serially... We had 
to rewrite our build scripts to use JOM for release builds due to this.


Hamish

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20191209/e7b4451b/attachment.html>


More information about the Interest mailing list