[Qt-interest] tips for optimising cold-start Qtapplication startup time on Windows (and OSX)?

Ross Bencina rossb-lists at audiomulch.com
Tue Apr 6 06:35:04 CEST 2010


Hi Alex

Thanks for your comments...

> In the second case you might want to write your own loader like google did 
> :P

Actually I already wrote a DLL scanner for pre-flighting plugins, but that's 
a different story :/

>>>
According to my experience the major time of application loading time 
usually is spend on reading QSettings  from registry (to restore states, 
ets), resource initialization ( for example  icons read from files  ) and 
not on [Qt or any other ] dll loading.
<<<

I do most of this after I display the splash screen, and at the moment it's 
taking a long time to get there. Problem is, a lot of this time is before 
WinMain. I guess I'd better check there isn't too much static/global 
constructor action there.

I agree about the settings loading. I don't use any low-level Qt stuff like 
QSettings, only GUI classes, but even my direct-to-the-metal Win32 registry 
access is sometimes slow on startup. I've been able to optimise some of 
this.

But I have done quite extensive profiling and I am still getting the 
impression that the slow cold-boot startup times are due to demand-loading 
of code pages. When comparing the cold-boot and warm-boot profiles it looks 
like additional time is incurred when the code constructs new classes/areas 
of Qt (and my exe code too). For example, warm-boot construction of 
QApplication is much faster that cold boot (12ms vs 300ms). Same goes for 
the first instance of a QWidget subclass.


>>>
My application, which loads like 50 dlls (vtk, Qt, etc)takes less than 2 sec 
to load (cold start) on desktop.
<<<

I could be wrong, but I suspect you have the Windows prefetcher enabled. 
That won't help with percieved startup time for new users (which is one of 
my issues -- I don't want a first-time user double clicking my app and 
waiting 5 seconds for the splash screen to come up -- that could cost me a 
sale.)


>>>
On other devices it might be slower, but first of all I would try to find 
other potential bottlenecks before trying to improve dll loading time.
<<<

I'm doing that :-)

Thanks!


Ross. 




More information about the Qt-interest-old mailing list