[Interest] Tricks to improve moc performance?

Adam Light aclight at gmail.com
Tue Jan 14 15:31:20 CET 2020


On Mon, Dec 23, 2019 at 2:26 PM Adam Light <aclight at gmail.com> wrote:

>
> One idea I had was to combine all files in HEADERS into a single giant .h
> file, and then call moc.exe once on that file. The single call to moc.exe
> would be executed in a single thread, but it would avoid the need to
> rediscover all of the header files from each of the 600 or so moc processes
> that would otherwise run.
>
>
I've come up with a feature that replaces the standard moc feature that
does exactly this. It's a bit fragile--it works for our project, but I
tried using it to build Qt Creator and there were errors. Someone better
with qmake might have more success making it more broadly useful.
Ultimately, I think the best approach would be to allow moc to accept a
list of files to be mocced, but as is I don't think qmake can (easily?) be
used to supply that list.

Using this new feature, it takes only 2-3 seconds to moc all of the 550 or
so mocable header files in our project, versus over 60 seconds without the
feature. So builds are much faster, and the feature almost eliminates the
performance killing effects of the bindflt minifilter driver I mentioned
earlier in the thread.

I've created a feature request at
https://bugreports.qt.io/browse/QTBUG-81348 that contains two versions of
the new feature as well as a detailed description of the problem and what I
have learned while investigating it.

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


More information about the Interest mailing list