[Interest] porting to Qt 5.4 - MOC very slow on Windows
Hamish Moffatt
hamish at risingsoftware.com
Fri Jan 16 02:00:53 CET 2015
On 15/01/15 19:23, Koehne Kai wrote:
>
>> -----Original Message-----
>> From: interest-bounces+kai.koehne=theqtcompany.com at qt-project.org
>> [mailto:interest-bounces+kai.koehne=theqtcompany.com at qt-project.org]
>> On Behalf Of Hamish Moffatt
>> Sent: Thursday, January 15, 2015 7:34 AM
>> To: interest at qt-project.org
>> Subject: [Interest] porting to Qt 5.4 - MOC very slow on Windows
>>
>> I'm trying to port our app from Qt 4.8 to 5.4. Currently working in MSVC 2013,
>> and using the pre-built Qt binaries for that environment.
>>
>> We have about 440 files being MOCed during build. On 5.4, each file is taking
>> 2-3 seconds meaning the overall build is significantly longer than in 4.8.
>>
>> I found a reference to a similar problem here -
>> http://qt-project.org/forums/viewthread/47901 - which was due to using
>> MOC on a network drive. In my case everything is on local SSD.
>>
>> Any suggestions?
> IIRC moc in Qt 5 got much more accurate in the parsing phase, which might mean it now parses included headers that it previously missed.
>
> 2 - 3 seconds is quite long though ... Maybe running procmon.exe to monitor all file accesses done by moc gives you a hint?
>
>
Good suggestion. I've found that MOC is spending a lot of time searching
for headers. We have lots of source directories in the include path, and
MOC is searching all of them before the Qt and MSVC directories. Even
when searching for stddef.h, QObject etc. And strangely enough it seems
to be trying to open the file in each path twice.
In comparison, MOC 4.8 seems to know how to find the Qt headers without
searching everywhere. It still searches all over for stddef.h,
<algorithm> etc but only tries each location once.
I see that MOC is being told to read a mocinclude.tmp file which lists
all the include directories. In 4.8, the QT directories are first. In
5.4, the QT directories are last.
Hamish
More information about the Interest
mailing list