[Interest] Tricks to improve moc performance?

Henry Skoglund henry at tungware.se
Fri Dec 6 03:37:57 CET 2019


On 2019-12-06 02:09, Adam Light wrote:
> We have several machines running Windows 10 that are quite powerful 
> (eg. 8 or 16 core (16 or 32 thread) processors, lots of RAM, NVMe SSD 
> storage). However, since upgrading to Windows 1903, we have noticed 
> that sometimes the compile time of our large Qt 5.12 based application 
> increases dramatically.
>
> As an example, on one 16 core/32 thread machine, a debug build can 
> take as little as 4 minutes. However it sometimes takes 18 minutes. 
> This is for the exact same code, compiler, settings, etc. I can 
> literally do a full build that takes 4 minutes, do something, delete 
> the build directory and rebuild and now it takes 16 minutes. The "do 
> something" may be going to lunch or making a trivial change in the 
> code. Otherwise the state of the machine is the same (no other 
> heavyweight processes running, etc.)
>
> We see this behavior both when using Qt Creator 4.10.2 to do the build 
> (using jom.exe) and also when done outside of Creator with calls to 
> qmake and then jom. All files involved in anything I mention here are 
> on and/or written to the local SSD. I see these issues with no 
> antivirus running, no backup, etc.
>
...
> Does anyone else have any ideas of how we could change our build to 
> improve moc performance when Windows decides to be "slow"? Like, for 
> example, is there any way to have the moc calls run with only a few 
> moc processes running at once but have the rest of the build done with 
> all threads running. I'm pretty sure that the OS slowdown has 
> something to do with thread contention of some sort.
>
> If anyone thinks they have run into this situation or is intimately 
> familiar with Windows minifilter drivers, I'm happy to share the 
> details behind why I think they are involved here.
>
> Thanks for any ideas
> Adam
>

Hi, just guessing, but it could be network related. For a quick test, 
when you experience that slowdown, try pulling out the network cable 
from the PC and see if the build time changes.

For a more elaborate test, consider moving your Windows build PC into 
the virtual realm, say like this: Use Disk2vhd 
https://docs.microsoft.com/en-us/sysinternals/downloads/disk2vhd to 
migrate your C: into a .vhd file. Install Ubuntu 19.10 on the PC and 
VirtualBox (or VMWare Workstation player, also free). Then load up the 
.vhd file into Ubuntu and, in my case, that combo (a virtual Windows 
running inside Ubuntu) builds faster than my vanilla Windows 10 ever did.

This year when 1903 arrived I saw some changes as well, the boot/startup 
time is better but I felt it was slower in general than 1809. So I dug 
up an old Windows 7 DVD and installed it into VMWare and reinstalled Qt 
on that Windows 7. Upgrading from Windows 10 to Windows 7 made jom happy 
again. So while it's impossible today to find a new PC that you can 
install Windows 7 on, it is still very much possible on VirtualBox or 
VMWare. Finally, since Microsoft will cease support of Windows 7 next 
month, make sure *never* to browse the internet or do your email from 
Windows 7, always use Ubuntu.

Rgrds Henry



More information about the Interest mailing list